# Git Branch Name Validator

Validate Git branch names according to Git naming conventions

> Canonical page: https://elysiatools.com/en/tools/git-branch-validator

- **Category:** Development

- **Keywords:** git, branch, validator, naming, convention, Git Branch Name Validator

## Overview

### 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

## Inputs

- **Branch Name** (text): Enter Git branch name to validate...
- **Allow Custom Prefixes** (checkbox): Allow branch names without standard prefixes
- **Enforce Naming Convention** (checkbox): Require branch names to follow naming conventions
- **Reserved Branch Names** (text): Branch names that are reserved (comma-separated)
- **Maximum Length** (number): Maximum length for branch names (filesystem compatibility)
- **Allowed Prefixes** (text): Valid branch name prefixes (comma-separated, end with /)

## When to use

- When creating a new Git branch to ensure it meets naming standards
- Before committing code to validate branch names in pre-commit hooks
- In CI/CD pipelines to automatically enforce naming conventions

## How it works

- Enter the branch name you want to validate in the input field
- The tool applies Git's naming rules and any custom settings like allowed prefixes or maximum length
- Receive a JSON response indicating validity and listing any specific violations

## Use cases

- Automating branch name validation in development workflows
- Integrating with Git hooks to prevent invalid commits
- Standardizing branch names across teams and projects

## Frequently asked questions

### What invalid characters does the tool check for?

It checks for characters like ~, ^, :, spaces, tabs, newlines, ?, *, [, \, and others as per Git rules.

### Can I allow custom prefixes beyond the defaults?

Yes, use the allowedPrefixes option to specify prefixes such as 'feature/', 'bugfix/', or others.

### What is the default maximum branch name length?

The default is 255 characters for filesystem compatibility, but you can adjust it with the maxLength option.

### How do I add reserved branch names?

Use the reservedNames option to input comma-separated names like 'HEAD,main,master' that should be avoided.

### What format is the validation result in?

The result is in JSON format, showing whether the name is valid and any errors found.

## Related tools

- [Variable Name Validator - Multi-Language Naming Convention Checker](https://elysiatools.com/en/tools/variable-name-validator): Validate variable names against multiple programming language naming conventions and standards
- [Tailwind Color Palette Sync](https://elysiatools.com/en/tools/tailwind-color-palette-sync): Generate theme.extend.colors for tailwind.config.ts from HEX colors, with WCAG contrast levels and optional dark mode.
- [API Contract Mutation Tester](https://elysiatools.com/en/tools/api-contract-mutation-tester): Mutate OpenAPI request fields into semantically risky variants and optionally send them to a real backend to check defensive validation coverage
- [OpenTelemetry W3C traceparent / tracestate / baggage + OTLP Header Propagation Validator](https://elysiatools.com/en/tools/opentelemetry-w3c-traceparent-tracestate-baggage-and-otlp-protobuf-headers-propagation-validator): Validate W3C Trace Context propagation headers end to end: traceparent (version / 16-byte trace-id / 8-byte parent-id / trace-flags), tracestate (≤32 list members, tenant keys), baggage (percent-encoded values + opaque properties), OTLP export Content-Type, the gRPC grpc-trace-context-bin 25-byte binary context — plus a two-header correlation round-trip with a random child span-id collision check.
- [AI Domain Name Idea Generator](https://elysiatools.com/en/tools/ai-domain-name-idea-generator): Generate up to 10 creative domain names with AI and filter out already-registered ones via DNS + RDAP.
- [Cron Expression Tester](https://elysiatools.com/en/tools/cron-expression-tester): Test and validate cron expressions, see future execution times
- [Docker Image Tag Validator](https://elysiatools.com/en/tools/docker-image-tag-validator): Validate Docker image names and tags according to Docker naming conventions
- [URL Validator](https://elysiatools.com/en/tools/url-validator): Validate and analyze URLs for correctness and security

## Samples

- [Git Branch Name Samples](https://elysiatools.com/en/samples/git-branch-names): Collection of Git branch names for validation testing, including valid patterns, invalid formats, and real-world examples
- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
