Files
pepperplus-ui/.githooks/pre-commit
2025-10-06 08:00:59 +00:00

18 lines
466 B
Bash
Executable File

#!/bin/sh
# Get current branch
branch=$(git rev-parse --abbrev-ref HEAD)
if echo "$branch" | grep -Eq "(dev|main)"; then
echo 0
fi
# allowed pattern <type/>
if echo "$branch" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert)\/\w+-\w+-\w+"; then
echo "✅ Branch name valid: $branch"
exit 0
else
echo "❌ Invalid branch name: $branch"
echo "Branch must be named <type>/<description-of-branch> (must have 2 stipes - -)"
exit 1
fi