Fix Git line endings on Windows + Cygwin or WSL
When using Git on Windows with Cygwin or Windows Subsystem for Linux, CRLF conflicts can falsely make your Git repo “dirty”.
git diff from Cygwin or WSL will show
^M at the end of each line and not let you merge code on
This can cause missed code changes or needless commits.
We suggest to force LF line endings no matter what environment the user is in.
Even Windows Notepad supports LF line endings.
Fix this by creating in each Git repo a file .gitattributes including:
DO NOT just use
* as that can goof up binary files in your repo.
git config --global core.autocrlf input git config --global core.eol lf
This tells Git to force line endings
\n on committed files.