Skip to content

Instantly share code, notes, and snippets.

@emichael
Last active January 24, 2016 00:52
Show Gist options
  • Save emichael/6bc89112d03a8c50f96e to your computer and use it in GitHub Desktop.
Save emichael/6bc89112d03a8c50f96e to your computer and use it in GitHub Desktop.
Normalize line endings in a git repo
echo "* text=auto" >> .gitattributes
git add .gitattributes
git commit -m "Adding line endings settings"
git rm --cached -r .
git reset --hard
git add .
git commit -m "Normalize line endings"
git rm --cached -r .
git reset --hard
# This command should now return nothing
find . -not -type d -exec file "{}" ";" | grep CRLF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment