Skip to content

Instantly share code, notes, and snippets.

View ashaindlin's full-sized avatar

Alex Shaindlin ashaindlin

View GitHub Profile
@ashaindlin
ashaindlin / gist:c548baca0e663b53dfbd
Last active October 2, 2015 00:49 — forked from mxgrn/gist:663933
Git's pre-commit hook to remove trailing whitespaces/tabs
#!/bin/sh
#
# This will abort "git commit" and remove the trailing whitespaces from the files to be committed.
# Simply repeating the last "git commit" command will do the commit then.
#
# Put this into .git/hooks/pre-commit, and chmod +x it.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else