-
-
Save tjboudreaux/8544508db44f91c7ff32 to your computer and use it in GitHub Desktop.
Git hook that prevents commits to master
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/sh | |
# | |
# Git hook that prevents commits to master | |
# use --no-verify to bypass this hook | |
# ex: git commit -m "init commit" --no-verify | |
branch=`git symbolic-ref HEAD` | |
if [ "$branch" = "refs/heads/master" ]; then | |
echo "Direct commits to the branch master are not allowed" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment