I don't understand why but when someone commits new file it shows on my end as if I deleted everything and re-written exactly the same thing when I didn't even touch the file.
We both use Windows. Any idea what causes this and how to avoid it?
I don't understand why but when someone commits new file it shows on my end as if I deleted everything and re-written exactly the same thing when I didn't even touch the file.
We both use Windows. Any idea what causes this and how to avoid it?
They're certainly not the same, or else git wouldn't have mentioned that they were different. So there is only one possibility if everything else looks the same: the stuff you can't see must be different, i.e. white space.
It's likely not a space/tab kind of issue based on your screen shot. So it's almost certainly either white space at the end of the line (like extra spaces) or the ever so much more likely cr/lf issue with using windows.
You need to carefully set core.eol
, core.safecrlf
and core.autocrlf
. In particular, if you set core.safecrlf
to true git will actually yell at you if you edited it incorrectly.
If you want to check what actually happened, you'll likely need to open in checkin via it's tag and check the line-endings using an editor that can display them, or you can simply check the size before and after. The crlf version of the file should be longer because of the extra CR. In fact, it should (based on your diff) be 108 bytes longer.