Prevent git from handling deletion and a new file with changes in move quality

I use Git to track changes to XML configurations for virtual machines. Many of the XML configurations are similar, with several fields that differ from each other. I often delete VM configurations and add new ones. When adding these changes to the repo, Git treats it as a file rename, just a few changes. I could understand why Git would do this and understand that it was being used.

I am wondering if there is a way to prevent this, and instead, Git treat it as deleting a file with a new file creation. When viewing commit logs, it would be much easier to distinguish "oh, it looks like I deleted this virtual machine that day and created a new one"

+7
source share
2 answers

Renaming is just something displayed on the output, inside they are stored as regular deletions and creations.

If you want to disable rename detection, you can use the --no-renames :

 git log --stat --no-renames 

(also works with git diff , git show , etc.)

If you do not want to constantly add this option, you can add it to your configuration:

 git config diff.renames false 
+11
source

Don't worry, Git simply displays the change as a rename, as it looks like a rename. It does not save it as a rename, since there is no way for Git to do this. Rename detection occurs when a commit is displayed, and not in recording mode.

You can use git show --no-renames to avoid rename detection, even if you turned it on by default.

+3
source

All Articles