Windows ends lines with carriage-return and linefeed
CRLF
. Mac and Linux use only a linefeed
LF
. Enter
git config core.autocrlf
to the rescue!
View it
git config --get core.autocrlf
Set it
git config --global core.autocrlf=input
This is what the three alternatives do.
true
-
git checkout
convertsLF
toCRLF
-
git add
convertsCRLF
toLF
input
-
git checkout
converts neither -
git add
convertsCRLF
toLF
false
-
git checkout
converts neither -
git add
converts neither - reserve this setting for Windows-only projects
See also https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace