Created
October 10, 2014 22:57
-
-
Save shaneog/779e754153ee816ed226 to your computer and use it in GitHub Desktop.
Git pre-commit hook to prevent commits to master branch
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 | |
echo "Cannot commit to master branch" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment