Skip to content

Instantly share code, notes, and snippets.

@StephenVinouze
Created May 28, 2020 18:02
Show Gist options
  • Save StephenVinouze/20bb168ce7eb3966cd3e288eb41215e8 to your computer and use it in GitHub Desktop.
Save StephenVinouze/20bb168ce7eb3966cd3e288eb41215e8 to your computer and use it in GitHub Desktop.
#!/bin/sh
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REGEX="^(develop|master|release|((feature|bigfeature|task|bugfix|hotfix)\/[A-Z]+-[0-9]+_[A-Z]+_.+))$"
if ! [[ $BRANCH =~ $REGEX ]]; then
echo "Your commit was rejected due to branching name"
echo "Please rename your branch with $REGEX syntax"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment