Last active
March 22, 2019 17:27
-
-
Save codingmatty/c1677149321a021bc40e90dbba58c053 to your computer and use it in GitHub Desktop.
Check to make sure you are on a clean master branch
This file contains 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
#!/bin/bash | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Aborting! Branch is unclean."; | |
exit 1 | |
elif [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then | |
echo "Aborting! Not on master branch."; | |
exit 1; | |
elif [ "$(g rev-list master...origin/master)" != "" ]; then | |
echo "Aborting! Master branch not in sync with origin."; | |
exit 1; | |
else | |
echo "No git changes found."; | |
exit 0; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment