Skip to content

Instantly share code, notes, and snippets.

@randy3k

randy3k/pre-commit

Created Aug 30, 2018
Embed
What would you like to do?
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