Created
November 23, 2015 09:06
-
-
Save idlemoor/146533f97722b335057e to your computer and use it in GitHub Desktop.
Avoid commits to the 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/sh | |
# | |
# .git/hooks/pre-commit | |
# Avoid commits to the master branch | |
# dbs 2015-11-23 | |
# | |
# You need to copy this file to .git/hooks/ in each relevant repository, and | |
# then you need to make the file executable: | |
# chmod ugo+x .git/hooks/pre-commit | |
# | |
# To circumvent this restriction, use --no-verify, e.g. | |
# git commit --no-verify -m 'Fix error in master branch' | |
if [ "$(git symbolic-ref HEAD)" = "refs/heads/master" ]; then | |
echo "Sorry Tim, you're trying to commit to master again." | |
echo "To insist on your right to do so, please use '--no-verify'." | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment