One of our developers' text editor messes up the line endings of our PHP files. We've tried all settings, but the editor still seems to replace the CR-LF's with LF's on saving.
Of course, the most sane thing to do is replace the editor with a decent one, but I though: why not configure Git for handling the differences in line ending? Here's where I get stuck; I can't get it to work properly and I'd like your advice.
It seems the files we check out have CR-LF line endings. When our developer edits them and stores them, they same to have LF endings. When committing the file, not only do the lines change, but every line is removed and inserted again.
I've set core.autocrlf
to true
. When committing, I get a warning that all LF will be replaced by CR-LF. The file will have the original endings in your work directory. But still, all lines are removed and added again. When merging with another branch, this gives conflicts.
I tried making a .gitattributes
file with *.php text
. Same result as with core.autocrlf
.
So my question is: is there a way to configure Git to only commit the changes our programmer's made and leave alone the lines where only the line ending has changed?