We have some configuration options for the rename detection heuristics during diff
(log
, show
) and merge
:
diff.renameLimit The number of files to consider when performing the copy/rename detection; equivalent to the git diff option -l.
diff.renames Tells git to detect renames. If set to any boolean value, it will enable basic rename detection. If set to "copies" or "copy", it will detect copies, as well.
merge.renameLimit The number of files to consider when performing rename detection during a merge; if not specified, defaults to the value of diff.renameLimit.
Also we have an option to control when files with different contents are considered a rename for diff
(log
, show
):
-M[<n>] (or --find-renames[=<n>])
Detect renames. If n is specified, it is a threshold on the similarity index (i.e. amount of addition/deletions compared to the file’s size). For example, -M90% means git should consider a delete/add pair to be a rename if more than 90% of the file hasn’t changed.
QUESTION: How to control a threshold on the similarity index for merge? It seems to be available only as a command-line option for diff
and some others but not merge
. And no configuration key even for diff
. Is it not applicable for merge
for some reason?
If you're merging with the recursive merge strategy (default) you can use the rename-threshold option:
git merge -X rename-threshold=80 branch
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