I've performed several refactors in eclipse where I move a large set of files to another java package. These often result in a lot of files being automatically updated to resolve references. So, the commits in these cases tend to be quite large.
I assumed that git tracked the renames and I could use git log --follow
to follow the history back through the rename, but git didn't track the renames.
I've performed smaller refactor operations in eclipse where the renames are detected on commit. The only difference seems to be the size of the commits.
Any ideas?
Git does not track renames in history at all, but git log
can heuristically detect renames based on the commit contents.
-M
percent to git log
in order for the renames to be detected. If more than some percent of the file has changed, git log
(and git diff
) won't consider an add/delete pair to be a rename. If the files moved were very small and required content changes (to package names for example) then they might exceed this threshold.-l
too, which specifies the maximum number of potential renames to evaluate. In large commits, you may very well be exceeding this, and so Git doesn't evaluate renames to keep the log operation from taking too long. (Detecting renames is an O(n^2) operation, where n is the number of add/delete pairs that need to be considered, so the time taken to process each commit in a log operation looking for renames increases exponentially with the number of add/delete permutations.)See the git-log manpage for more detailed descriptions of these options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With