When using Git on Windows with Cygwin or Windows Subsystem for Linux, CRLF conflicts can falsely make your Git repo “dirty”.
git diff will show
^M at the end of each line and not let you merge code on
This is very annoying by wasting time and possibly causing missed code changes and needless commits.
One approach is to force LF line-endings no matter what environment the user is in.
Fix Git Windows CRLF line-ending hell
Create in each Git repo a file
*.py text eol=lf *.c text eol=lf *.cpp text eol=lf *.h text eol=lf *.f text eol=lf *.for text eol=lf *.f90 text eol=lf
DO NOT just use
* as that can goof up binary files in your repo.
git config --global core.autocrlf false
This tells Git not to generate line endings
\r\n, and on Linux & Mac to force line endings