Skip to content

Instantly share code, notes, and snippets.

@philwilliammee
Last active January 25, 2019 19:42
Show Gist options
  • Save philwilliammee/c9557f6b5ec891434f121dc461f20926 to your computer and use it in GitHub Desktop.
Save philwilliammee/c9557f6b5ec891434f121dc461f20926 to your computer and use it in GitHub Desktop.
# https://help.github.com/articles/dealing-with-line-endings/
git add . -u
git commit -m "Saving files before refreshing line endings"
# Remove the index and force Git to rescan the working directory.
rm .git/index
# Rewrite the Git index to pick up all the new line endings.
git reset
# Show the rewritten, normalized files.
git status
# Add all your changed files back, and prepare them for a commit. This is your chance to inspect which files, if any, were unchanged.
git add -u
# It is perfectly safe to see a lot of messages here that read
# "warning: CRLF will be replaced by LF in file."
# Rewrite the .gitattributes file.
git add .gitattributes
# Commit the changes to your repository.
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