Last active
March 25, 2017 00:38
-
-
Save eddywashere/107b33b35601d21b1a2a 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