Skip to content

Instantly share code, notes, and snippets.

@tonidezman tonidezman/instructions.sh
Last active Aug 29, 2018

Embed
What would you like to do?
git pre-push hook
# 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
You can’t perform that action at this time.