I started to see that in some commits of my colleges, the files they changed a few lines are "marked" as if they modified them completely. We are losing the possibility to use Git Blame on these files to see "who changed which line"
I can't figure it what they are doing "wrong" to override the file and to make Git lose the capability of Blame, could it be related to rebasing? or rebase -i
and squashing?, is it a bug related to a Git version?, they use Linux and I use Windows
I created a secondary account on our git repository (Assembla) and tried to reproduce this but I couldn't
Before
After
It's more than likely because the files are getting an EOL-format change. Why? It could be because the developers are not being careful with that (IDE messing them up?)... or, most likely, that you have set up git to change EOL format of the files (
core.autocrlf
rings a bell?). You can still see through those revisions usinggit blame -w
. My best advice: rewrite history of the branches so that the EOL format never happens (it has a price tag.... in terms of effort, just in case)... and do not set up git to change eol formats.PS I am writing a guide on how to deal with conflicts and I am currently working on a script to be able to, kind of painlessly, rewrite the history of a branch so that the EOL format changes are corrected.... but it will be ready in a few days till I release it. I can write an update here if you want. The guide is here http://www.ezconflict.com/ (no tracking, no monetizing).
PS2: Script to correct EOL changes. It assumes (actually checks) that what you are asking to correct is a straight branch, no merges. Provide the last revision that had correct EOL formats, the tip of the branch (branch name, or revision) and the list of files that need to be corrected.
https://github.com/eantoranz/conflict_book/blob/main/scripts/correct_eol.sh
By the way, still hot from the oven. Use with caution (it won't move any branches, just in case).