Last active
August 29, 2015 14:23
-
-
Save phantom42/0cf24bbd90a2b0c67b98 to your computer and use it in GitHub Desktop.
how to deal with line crlf issues in git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the default behavior, in case people don't have core.autocrlf set. | |
* text=auto | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on this answer: http://stackoverflow.com/a/14129301/1147918 | |
git ls-files -m | xargs -i git update-index --assume-unchanged "{}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- instructions: https://help.github.com/articles/dealing-with-line-endings/, based on http://stackoverflow.com/a/1511273/1147918 | |
git config --global core.autocrlf true | |
git add . -u | |
git commit -m "Saving files before refreshing line endings" | |
git rm --cached -r . | |
git reset --hard | |
git add . | |
git commit -m "Normalize all the line endings" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment