We have a mixed team with some people using Windows and others using Linux. We have configured the IDE (Eclipse) to use LF as line ending for source files which works well.
But we also share launch configs. These are XML files and Eclipse ignores the project settings for them. Instead, it always uses the platform's line ending when writing the file.
To solve this, we have these lines in .gitattributes
:
**/* eol=lf
**/*.launch text
My understanding of this configuration is "when Git does a checkout of any file with the extension .launch
, no matter where in the tree, it will convert the line endings to the platform's default (no matter what they were in the Git repo)". See the docs on github:
text
This setting tells git to always normalize the files specified. When committed they are stored with LF, on checkout they are converted to the OS's native line endings.
Only it doesn't work. I'm still seeing people committing files where every line changed; diff -R
(as per this answer) shows that Git created a file with CRLF on my Linux box.
git checkout -- server.launch
doesn't change anything.
What is going on here?
Is there a way to tell Git to simply ignore any line ending changes in some files?