Created
April 3, 2012 10:10
-
-
Save jlecour/2290813 to your computer and use it in GitHub Desktop.
Any (executable) "pre-commit" script in .git/hooks is always executed before commiting, so if it returns a non-0 value, it halts the commit. There i put some external scripts, like this one to stop if the commit would be on master directly.
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 | |
if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]] | |
then | |
echo "You cannot commit in master!" | |
exit 1 | |
fi |
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 | |
set -e | |
.git/hooks/_no_commit_on_master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment