public
Created

Useful git hooks

  • Download Gist
pre-commit.sh
Shell
1 2 3 4 5 6 7 8 9 10 11
# stash unstaged changes so they are not included in the tests
git stash -q --keep-index
 
npm test
RESULT=$?
 
# put the unstaged changes back
git stash pop -q
 
[ $RESULT -ne 0 ] && exit 1
exit 0

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.