Branch Naming
Consistent Git branch naming conventions.
Convention
<type>/<description>
<type>/<ticket-id>-<description>Ticket ID is optional — include it if your team uses an issue tracker.
Branch Types
| Type | Purpose | Example |
|---|---|---|
feature/ | New features | feature/user-authentication |
bugfix/ | Bug fixes | bugfix/fix-login-redirect |
hotfix/ | Urgent production fixes | hotfix/security-patch |
refactor/ | Code refactoring | refactor/cleanup-api |
docs/ | Documentation | docs/api-docs |
test/ | Test additions | test/add-unit-tests |
chore/ | Maintenance tasks | chore/update-deps |
Examples
# Good - without tickets
feature/user-authentication
bugfix/fix-login-redirect
hotfix/critical-security-fix
refactor/simplify-user-service
chore/upgrade-react-18
# Good - with tickets (if using issue tracker)
feature/PROJ-123-user-authentication
bugfix/PROJ-456-fix-login-redirect
hotfix/PROJ-789-critical-security-fix
# Bad
feature/new-stuff # Vague description
john/working # Personal name
fix # Too short, no type
PROJ-123 # No type or description
feature/implement-the-new-user-authentication-system-with-oauth
# Too longRules
- Always lowercase — No capital letters in branch names
- Use hyphens — Not underscores or camelCase
- Include ticket ID — Optional, but recommended if using issue tracker
- Keep it short — Max 50 characters for description
- Be descriptive — Clear purpose at a glance
Protected Branches
| Branch | Purpose | Protection |
|---|---|---|
main | Production code | Require PR, reviews, CI pass |
develop | Integration branch | Require PR, CI pass |
release/* | Release preparation | Require PR |
Workflow
# Create feature branch from develop
git checkout develop
git pull origin develop
git checkout -b feature/user-auth
# Work on feature...
git add .
git commit -m "feat(auth): add login form"
# Push and create PR
git push -u origin feature/user-authBranch Cleanup
# Delete local branch after merge
git branch -d feature/user-auth
# Delete remote branch
git push origin --delete feature/user-auth
# Prune deleted remote branches
git fetch --prune