Skip to content

Instantly share code, notes, and snippets.

@seniv
Created March 18, 2020 16:03
Show Gist options
  • Save seniv/2dd56c7f6019e9188d41468b1484c8e9 to your computer and use it in GitHub Desktop.
Save seniv/2dd56c7f6019e9188d41468b1484c8e9 to your computer and use it in GitHub Desktop.
Block commits on master and develop branches (add to "pre-commit" hook)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ $BRANCH == 'develop' -o $BRANCH == 'master' ]
then
echo "ERROR: Making commits to master or develop branches are not allowed."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment