All Articles

Complete guide to switching CRLF -> LF for Windows

1 min read

Complete guide to force setup LF End-of-line for all your Git projects working on Windows.


  1. Run
git config --global core.autocrlf false

from Git Console or when install Git:

Git install window

  1. Run
git rm --cached -r . 
git reset --hard

from Git Console from the root of your project

  1. Edit eol VS Code settings (User and Workspace):

![VS Code "End of line" settings](/media/crlf-to-lf-1.png “VS Code \\\\“End of line\\\\” settings”)

  1. 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