git - Generate a diff for a change that moved a function between files, and also changed slightly? -


in single commit, moved function new file, , made changes it.

github's diff viewer shows ~30 lines deleted old file, , 30 lines added new file - it's hard see differences existed in implementation of old file , new one.

are there tools can break down diff? can copy relevant sections of each new file, , run diff on these, , generate patch file suppose...

the command line git diff program has heuristic detecting renames not turned on default. enable via -m[<n>] or --find-renames[=<n>] option. example:

git show --find-renames <commit-sha> 

as have experienced, git not track renames. heuristic employs compare files deleted , added similarity. default similarity index 50%, can controlled =<n> argument. increase threshold 90% (the files must 90% same considered rename):

git show --find-renames=90% <commit-sha> 

if want git always detect renames, there's config knob that:

git config --global diff.renames=true 

for more information see git-diff documentation.


Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

java - Incorrect order of records in M-M relationship in hibernate -