Created
August 30, 2018 15:20
-
-
Save randy3k/7635e150ac8b737d1d688c6b4cae0ff1 to your computer and use it in GitHub Desktop.
git pre-commit which unstages eol whitespaces
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
#!/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