Last active
August 29, 2018 06:56
-
-
Save tonidezman/a274316d389b84729508892da48c94d1 to your computer and use it in GitHub Desktop.
git pre-push hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) cd /path/to/your/repo | |
# 2) touch .git/hooks/pre-push | |
# 3) chmod u+x .git/hooks/pre-push | |
# 4) add code below to the pre-push file | |
#!/usr/bin/env bash | |
echo "Running RSpec" | |
bundle exec rspec spec | |
exit_status=$? | |
if [ $exit_status -eq 0 ] | |
then | |
echo -en "\\033[32mTests are green, pushing...\\033[0;39m\n" | |
exit 0 | |
else | |
echo -en "\\033[1;31mCannot push, tests are failing. Use --no-verify to force push.\\033[0;39m\n" | |
exit 1 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment