This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://itnext.io/using-git-hooks-to-enforce-branch-naming-policy-ffd81fa01e5e | |
LC_ALL=C | |
local_branch="$(git rev-parse --abbrev-ref HEAD)" | |
#local_branch='testing here' | |
valid_branch_regex="^(develop|feature|bugfix|improvement|prerelease|release|hotfix)\/[a-z0-9.-]+$" | |
valid_main_branch_names=( "master" "develop" "dev" "qa" "staging") | |
error_message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." |