Created
August 2, 2019 08:16
-
-
Save vikeri/202674c0bc272291b7f854af66b438a9 to your computer and use it in GitHub Desktop.
Prevent commit on 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 | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# To enable this hook, rename this file to ".git/hooks/pre-commit". | |
if [ $(git rev-parse --abbrev-ref HEAD) == "master" ] ; then | |
echo "\033[1;31mCan't commit directly to master\033[0m" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment