Skip to content

Instantly share code, notes, and snippets.

@thikade
Created November 1, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thikade/7546bdaa01e7b2d28798fb126ad40c4a to your computer and use it in GitHub Desktop.
Save thikade/7546bdaa01e7b2d28798fb126ad40c4a to your computer and use it in GitHub Desktop.
Git replacing LF with CRLF

Problem: git replacing LF with CRLF

why: see https://stackoverflow.com/a/20653073/2249526

Solution

https://stackoverflow.com/a/29888735/2249526

If you already have checked out the code, the files are already indexed. After changing your git settings, say by running:

git config --global core.autocrlf input 

you should refresh the indexes with

git rm --cached -r . 

and re-write git index with

git reset --hard

https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings

Note: this is will remove your local changes, consider stashing them before you do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment