Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git commit ignore line endings

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!

like image 750
cnom Avatar asked Nov 10 '22 22:11

cnom


1 Answers

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!! :)

like image 59
cnom Avatar answered Nov 15 '22 06:11

cnom