Skip to content

Instantly share code, notes, and snippets.

@Sonare
Last active November 13, 2022 22:27
Show Gist options
  • Save Sonare/b589092542340e620efc32d98fe3d3d5 to your computer and use it in GitHub Desktop.
Save Sonare/b589092542340e620efc32d98fe3d3d5 to your computer and use it in GitHub Desktop.
forbid commiting into master branch
#!/bin/sh
#
git rev-parse --abbrev-ref HEAD | grep -v -E "^master$" > /dev/null
if [ $? -ne 0 ]; then
echo "Current Branch is master"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment