Because a cherry-pick is a merge, Git will sometimes figure this out on its own. If Git does not figure this out on its own, you can try fiddling with the rename-detection threshold level: git cherry-pick -X find-renames=value
. The value
can be expressed as a percentage, with a literal percent character, e.g., 50%
(the default), 75%
(tighten rename finding if it's finding renames that don't actually make sense), 25%
(loosen rename finding if it's failing to find renames), and so on. Or, as long as the value is expressed as exactly two digits, you can leave off the %
character:
git cherry-pick -X find-renames=25 <hash>
If your Git is very old, find-renames
may be spelled rename-threshold
instead. Consult your installed Git documentation, specifically that for git merge
.
If lowering the rename threshold all the way (to 01
; zero just means "disabled" so does not work) does not help, there is unfortunately no easy way to deal with this. You can turn the commit into a patch—e.g., with git format-patch
—and edit the path name in the resulting patch, though.