Created
November 12, 2011 02:10
-
-
Save doctyper/1359906 to your computer and use it in GitHub Desktop.
Check to see if we are on master branch. Stop accidental commits
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
#!/bin/sh | |
# Check to see if we are on master branch. Stop accidental commits | |
if [ $(git symbolic-ref HEAD 2>/dev/null) == "refs/heads/master" ] | |
then | |
if [ -f i_want_to_commit_to_master ] | |
then | |
rm i_want_to_commit_to_master | |
exit 0 | |
else | |
echo "Cannot commit to master branch" | |
echo "Remember to create file 'touch i_want_to_commit_to_master' to commit to master" | |
fi | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment