Git doesn't track renames
I had a file dir1/some.class.
I copied it as dir2/some.class and commited + pushed.
Some weeks later, I've removed the dir1 version.
Can I teach git to act as if it was a move, rather than a new file?
So all changes to dir1/some.class that I will merge from other branches will actually merge into dir2/some.class ?
I tried with
git checkout mybranch
git config merge.renameLimit 100
git merge --no-ff -X rename-threshold=80 master
git config --unset merge.renameLimit
some of the files got merged. But some don't. Especially what I'm missing, is a git log ability, to see changes to dir2/class originated at the past as dir1/class, but that doesn't happen.

What actualy helped me was
Low renaming threshold (10% similarity to consider a file renamed)
Large merge.renameLimit ( consumes a lot of ram during merge )
git checkout mybranch
git config merge.renameLimit 999999
git merge --no-ff -X rename-threshold=10 -Xignore-space-change master
git config --unset merge.renameLimit
Also check out the answer marked below.
I would try this: in the branch you're merging in, rename dir1 to dir2 (you can do this on a new, temporary branch if you want). Then merge that into your main 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