Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@randy3k
Created August 30, 2018 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randy3k/7635e150ac8b737d1d688c6b4cae0ff1 to your computer and use it in GitHub Desktop.
Save randy3k/7635e150ac8b737d1d688c6b4cae0ff1 to your computer and use it in GitHub Desktop.
git pre-commit which unstages eol whitespaces
#!/bin/sh
git diff --ignore-space-at-eol -U0 --cached > foo.patch
git reset
git apply --ignore-whitespace --unidiff-zero --cached foo.patch
rm foo.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment