Make git ignore rename [duplicate]

2020-03-01 05:45发布

I have a file foo.txt which I want to delete, and another, bar.txt, that I wish to add. If these two files have more than 50% content that is the same, Git will consider that foo.txt is being renamed to bar.txt. How can I make Git really see this as an individual remove, with an individual add, in the same commit, without changing the global threshold detection %.

Thanks!

标签: git rename
2条回答
混吃等死
2楼-- · 2020-03-01 06:12

You can't. Internally, they will be saved as a deletion and an addition. The display of "rename" will be calculated later and depends on that threshold.

查看更多
我想做一个坏孩纸
3楼-- · 2020-03-01 06:25

To disable rename detection with TortoiseGit (though as being git-diff option, should apply to git by itself as well) I added the following line to gitconfig, which seems to do the trick (although based on documentation, I don't think it should):

[diff]
  renameLimit = 1
查看更多
登录 后发表回答