Last active
August 29, 2015 14:05
-
-
Save tmarwen/9d6e8a548f44eb5c37df to your computer and use it in GitHub Desktop.
Fix line endings after repo initialization
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
#Thanks to Charles Bailey for his answer in this SO post: http://stackoverflow.com/a/1511273/2106516 | |
# From the root of your repository remove everything from the index | |
git rm --cached -r . | |
# Change the autocrlf setting of the repository (you may want | |
# to use true on windows): | |
git config core.autocrlf input | |
# Re-add all the deleted files to the index | |
# (You should get lots of messages like: | |
# warning: CRLF will be replaced by LF in <file>.) | |
git diff --cached --name-only -z | xargs -0 git add | |
# Commit | |
git commit -m "Fixed crlf issue" | |
# If you're doing this on a Unix/Mac OSX clone then optionally remove | |
# the working tree and re-check everything out with the correct line endings. | |
git ls-files -z | xargs -0 rm | |
git checkout . | |
#For more informations about git core.autocrlf config property and what its preferred value; take a look at http://stackoverflow.com/a/1250133/2106516 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment