Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
prevent commit to master branch
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to master branch"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment