Skip to content

Instantly share code, notes, and snippets.

@mrtrkmn
Last active October 24, 2019 13:52
Show Gist options
  • Save mrtrkmn/b44c09df3a86286d017cdd3a01e4f87c to your computer and use it in GitHub Desktop.
Save mrtrkmn/b44c09df3a86286d017cdd3a01e4f87c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
LC_ALL=C
## check branch name length
current_local_branch="$(git rev-parse --abbrev-ref HEAD | grep -E '^[a-z]{2,15}\-.*-#[0-9]{1,3}$')"
if [ ${#current_local_branch} -gt 25 ]
then
printf "Branch name is too long !! make it wisely !!\n"
exit 1
fi
if [ ${#current_local_branch} -le 10 ]; then
printf "Length of branch ${#current_local_branch} proper length is 10 > and 25 < \n"
printf 'Branch names which are not under example convention will not be accepted ! \n'
printf 'Example: define-git-hooks-#29 > verb-noun-issuenumber\n'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment