Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent git from treating delete & new file w/ changes as a move [duplicate]

Tags:

git

I'm using Git to track changes to XML configurations for virtual machines. Many of the XML configurations are similar, with just a few fields that are different. I often delete VM configurations and add new ones. When adding these changes to the repo, Git treats it as a file rename, with just a few changes. I could see why git would do this, and understand it's use case.

I'm wondering if there's a way to prevent that, and instead have git treat it as a file deletion with a new file creation instead. When looking at the commit logs, it would be much easier to discern "oh, looks like on this day I deleted this VM and created a new one"

like image 701
Brian Avatar asked Apr 23 '13 14:04

Brian


1 Answers

Renames are only something shown in the output, internally they are stored just as regular deletions and creations.

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

git log --stat --no-renames

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

If you don't want to add this option all the time, you can add it to your config:

git config diff.renames false
like image 68
Schnouki Avatar answered Oct 12 '22 20:10

Schnouki