Git Branch Name Validator
This tool validates Git branch names according to Git's naming conventions and best practices.
Git Branch Naming Rules:
- Cannot contain:
~ ^ : space tab newline ? * [ \
- Cannot begin or end with
/
- Cannot have consecutive slashes
//
- Cannot end with
.lock
- Cannot contain
.. or @{
- Maximum length (typically 255 chars for filesystem compatibility)
- Cannot be a reserved branch name (HEAD, main, master)
Common Branch Naming Conventions:
- feature/ - New features
- bugfix/ - Bug fixes
- hotfix/ - Urgent production fixes
- release/ - Release preparation
- develop/ - Development branch
- test/ - Testing branches
- docs/ - Documentation updates
- refactor/ - Code refactoring
Example Valid Names:
feature/user-authentication
bugfix/login-error
hotfix/security-patch-001
release/v1.2.3
Example Invalid Names:
feature user auth (contains spaces)
feature//double-slash (consecutive slashes)
.lock-branch (starts with dot)
feature/.lock (ends with .lock)
Use Cases:
- Validate branch names before creation
- Enforce team naming conventions
- Pre-commit hooks for branch naming
- CI/CD pipeline validation
- Code review automation