Skip to content

Instantly share code, notes, and snippets.

@chadrien
Created November 13, 2013 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadrien/7448765 to your computer and use it in GitHub Desktop.
Save chadrien/7448765 to your computer and use it in GitHub Desktop.
Git hooks for everyday PHP developer
#!/bin/sh
git stash >/dev/null
# if tests fail, do not push
exit_with_status() {
git pop >/dev/null
exit "$1"
}
TEST_COMMANDS=(
)
for TEST_COMMAND in "${TEST_COMMANDS[@]}"; do
$TEST_COMMAND
if [[ "0" != "$?" ]]; then
echo "lol nope"
exit_with_status 1
fi
done
exit_with_status 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment