+2

Log: follow file copy

Arno Baumfalk 8 years ago updated by Alexander Miloslavskiy 8 years ago 1

While refactoring some code, I often have to split up large files into smaller ones. This results in loosing the history of all code which is relocated from the original file.


As a countermeasure I found this workaround for git:

- first duplicate the original file (copy it using a new filename and/or location)

- commit this duplication without any changes (this is a commit which might not build properly)

- remove the duplicate code from both files

- commit changes (this commit should work fine)


On the commandline, using "git log --follow" it is now possible to track all changes of the new file across the duplication step. With smartgit this does not work; smartgit seems to follow renamed files only.


I would like to propose a (maybe optional) follow-copy-strategy in the log view - from my point of view only exact copies need to be detected, which should keep the cost at minimum.

You should try DeepGit which is specifically designed to follow code movements during investigation. With it, you will no longer need to do any artificial commits.