Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Running Grunt or Codeception on Git pre-commit hook
echo "Start Git pre commit hook"
#!/bin/sh
# stash unstaged changes, run release task, stage release updates and restore stashed files
NAME=$(git branch | grep '*' | sed 's/* //')
# don't run on rebase
if [ $NAME != '(no branch)' ]
then
git stash -q --keep-index
# grunt release
php codecept.phar run
RETVAL=$?
if [ $RETVAL -ne 0 ]
then
exit 1
fi
git add .
git stash pop -q
fi
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.