Git commit ignore line endings

3.9k views Asked by At

Is there a way to make git commit to ignore line endings?

I managed to figure out how to make git diff to ignore line endings with

git diff --ignore-space-at-eol

This way I got diff to display only the lines I actually edited.

But the problem is that git diff by default considers my file as changed in whole, and then it commits the change accordingly.

Also I tried

git config --system core.autocrlf true

git config --system core.autocrlf false

None of these solved my problem!

1

There are 1 answers

0
cnom On BEST ANSWER

It seems that there is NO way to make git commit to ignore line endings by default!!

Just beware of Merging tools!

I figured out that my teams setting for line endings was perfectly OK, but the merging tool spoiled several files during merging a branch, and from then on we have the nightmare of EOL!! :)