Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick and dirty pre-commit for git
### pre-commit.sh
# Store git index status
git stash -q --keep-index
PWD=`pwd`
$PWD/bin/run_tests.sh
# Store tests result
RESULT=$?
# Restore previous index status
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.