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 keeps track of changes to files in the working directory of a repository by their name. When you move or rename a file, Git doesn't see that a file was moved; it sees that there's a file with a new filename, and the file with the old filename was deleted (even if the contents remain the same).
Git will automatically detect the move/rename if your modification is not too severe. Just git add the new file, and git rm the old file. git status will then show whether it has detected the rename.
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.
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