Branch Naming Convention Hook
Enforce consistent branch naming patterns
Category:hooks-configs
Type:hook
Difficulty:beginner
git
automation
devops
beginner
Description
Pre-push hook that validates branch names follow your team's naming convention. Supports patterns like feature/, bugfix/, hotfix/ prefixes and Jira ticket integration.
Content
Resource Content
{
"hooks": {
"pre-push": [
{
"name": "branch-naming",
"command": "branch=$(git rev-parse --abbrev-ref HEAD) && [[ $branch =~ ^(feature|bugfix|hotfix|release)/.+ ]] || (echo 'Branch name must start with feature/, bugfix/, hotfix/, or release/' && exit 1)",
"description": "Enforce branch naming convention"
}
]
}
}Rate This Resource
0
Help others discover great resources
Statistics
0
Stars
0
Copies
404
Days ago
303
Views