Skip to content

Instantly share code, notes, and snippets.

@georgiyordanov
Last active February 15, 2019 12:40
Show Gist options
  • Save georgiyordanov/ea8c3daae004fa87ddf4111c3c353b7a to your computer and use it in GitHub Desktop.
Save georgiyordanov/ea8c3daae004fa87ddf4111c3c353b7a to your computer and use it in GitHub Desktop.
Normalize all files in a git repo to LF
#!/usr/bin/env bash
# Check current status
git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD --name-only | xargs dos2unix -i --
# Convert all files to LF and UTF-8 without BOM
git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD --name-only | xargs dos2unix -r --
# Check for tabs
git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD --name-only | xargs grep -e "^\t" --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment