I know this question has been asked a hundred times, but none of the answers are ever exactly satisfactory.
I have a lot of tools (eg protoc protobuf compiler) which seem to one day spit out \r and the next \r\n so I can never have the files checked out the right way for every one of my developers.
And after they run the code generation step every file looks dirty because line endings were invariably changed.
Rather than controlling both how the file is checked in/out for line endings, and the code generators settings; I would like to be able to quickly revert every file that is a line end only change after I run my code generation script.
----------------------UPDATE------------------------------
I have not yet found a totally satisfactory solution, but I have found the root of my problem.
My tool is generating \n but git is checking thing out in \r\n on windows.
To cope with this I have set the attributes for the files as such: echo "*.pb.h text eol=lf" >>.gitattributes
Note I tracked some of this down using
git ls-files --eol
if you continue running into the issue even after this you may want to run
git add --renormalize .
See: 'git status' shows changed files, but 'git diff' doesn't