You can rebase your branch while detecting renames like so:
git rebase --strategy-option="rename-threshold=10" master
Edit: Since Git 2.8.0, the term ‘rename-threshold’ has been deprecated in favor of ‘find-renames’.
At the moment I’m using Git 2.7.4, and so I could only actually verify that the above command worked in my case — you may need to use the term ‘find-renames’ if the above command doesn’t work in your case on your newer version of Git…
In this example,
- the current branch is rebased onto
master - the rename threshold of
10%is specified - changes in
masterto the original files will be placed in the new (renamed) files (as opposed to running merelygit rebase master). - note how the syntax is different compared to similar rename-detection functionality found in the
git diff,git log, andgit mergecommands
The git rebase documentation isn’t very clear about this rename-detection aspect in particular.. I thought I read in another command somewhere, that the term “rename-threshold” was deprecated, though in this context find-renames did not seem to work as a synonym — so if anybody knows about a better way to run this same command, please mention so 🙂