Complete guide to switching CRLF -> LF for Windows
Posted on
Complete guide to force setup LF End-of-line for all your Git projects working on Windows.
- Run
git config --global core.autocrlf false
from Git Console
or when install Git:
- Run
git rm --cached -r .
git reset --hard
from Git Console
from the root of your project
- Edit
eol
VS Code settings (User and Workspace):
- Create
.gitattributes
at the root folder:
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary