arieljannai
arieljannai

Reputation: 2146

How to handle multiple renames and mass refactor in GIT?

In one of our branches we're doing a major refactor to the codebase, which involves a lot of files moving to new locations, renaming and editing/reordering a lot of files.

When I look at the final diff overview in a pull-request I see a lot of files added or deleted, even though they were renamed (in the relevant diff-commit they're recognized as renamed, but not in the total overview).

I tried changing the rename-threshold from 50 to 25, and it helped in part of the times (some files are renamed and more than 75% different).

When all the files seems to be added and deleted instead of renamed it's much harder doing code review.

If I change the similarity threshold to 1% - how it will affect the diff process? It might mistake about files and think they are renamed / copied even though they weren't?

How are you handling refactoring like that?
How do you keep track of a lot of files that were changed and renamed in a pull-request?

Thanks!

Command line example. At the right side the similarity threshold is reduced to 25% Command line example. At the right side the similarity threshold is reduced to 25%

P.s we use Bitbucket, so that's also where we're looking at pr's and doing code review. But basically Bitbucket behave the same as the git cli in that part.

Upvotes: 2

Views: 405

Answers (1)

arush436
arush436

Reputation: 1806

I use Beyond Compare 4 for review. It provides a satisfying diff of all files changed/deleted/renamed/added etc. After installing it change your .gitconfig to look something like this:

[diff]
    tool = bc4

[difftool "bc4"]
    path = "C:/Program Files (x86)/Beyond Compare 4/BCompare.exe"

[merge]
    tool = bc4

[mergetool "bc4"]
    keepTemporaries = false
    trustExitCode = true
    keepBackup = false
    path = "C:/Program Files (x86)/Beyond Compare 4/BCompare.exe"

Then simply run: git difftool --dir-diff master mybranch

Upvotes: 1

Related Questions