How to handle widespread code format changes in a git repository

Solution 1:

I don't know how best to deal with some of the more invasive changes you're describing, but...

The -w option to git blame, git diff, and others causes git to ignore changes in whitespace, so you can more easily see the real differences.

Solution 2:

I would recommend making those evolutions one step at a time, in a central Git repo (central as in "public reference for all other repositories to follow):

  • indentation
  • then reordering methods
  • then renaming
  • then ...

But not "indentation-reordering-renaming-...-one giant commit".

That way, you give to Git a reasonable chance to follow the changes across refactoring modifications.

Plus, I would not accept any new merge (pulled from other repo) which do not have applied the same refactoring before pushing their code.
If applying the format process brings any changes to the fetched code, you could reject it and ask for the remote repo to conform to the new standards first (at least by pulling from your repo before making any more push).