Skip to content

Instantly share code, notes, and snippets.

@amk221
Created February 6, 2020 00:43
Show Gist options
  • Save amk221/f634a80aec395e72b79ad7f403e4c825 to your computer and use it in GitHub Desktop.
Save amk221/f634a80aec395e72b79ad7f403e4c825 to your computer and use it in GitHub Desktop.
Prevent comitting 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
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment