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 converts LF to CRLF
  • git add converts CRLF to LF

input

  • git checkout converts neither
  • git add converts CRLF to LF

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