Skip to content

Instantly share code, notes, and snippets.

@casmith
Last active November 7, 2017 15:12
Show Gist options
  • Save casmith/aa811d0fa94d2d310b5f84b06090c288 to your computer and use it in GitHub Desktop.
Save casmith/aa811d0fa94d2d310b5f84b06090c288 to your computer and use it in GitHub Desktop.
#!/bin/bash
if test $(git rev-parse --abbrev-ref HEAD) = "master" ; then
echo "Cannot commit on master"
exit 1
fi
if test $(git rev-parse --abbrev-ref HEAD) = "develop" ; then
echo "Cannot commit on develop"
exit 1
fi
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ $BRANCH == release* ]]; then
echo "Cannot commit on a release branch"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment