Created
August 12, 2022 09:40
-
-
Save anatooly/e4ab60ceac8912a3f137cfef82807525 to your computer and use it in GitHub Desktop.
pre-commit
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
#!/bin/bash | |
# | |
# Pre-commit hooks | |
# Check branch name | |
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^(?!((fix|feature)\/[a-zA-Z0-9\-]+)$).*' | wc -c` | |
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then | |
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim .git/hooks/pre-commit" | |
echo "Branch name should be like feature/lowerUpper09-EXY-134 - brand is two letters" | |
echo "edit regexp if you think something wrong" | |
echo "Skip pre-commit hooks with --no-verify (not recommended)." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment