Advertisement

Free Online Git Branch Name Validator

Validate branch names against configurable naming rules.

Waiting for input 0 chars
    Suggested name
    —
    Advertisement

    About the Git Branch Name Validator

    Branch names are shared identifiers. They appear in pull request titles, CI job names, deployment tags, chat notifications, and command histories. A naming convention makes it possible to see at a glance whether a branch is a feature, a fix, or a release, and which ticket it belongs to. This validator checks a branch against a set of configurable rules and suggests a cleaned-up version when something is wrong.

    The first group of checks mirrors Git's own reference rules. A branch cannot contain spaces, control characters, or the characters tilde, caret, colon, question mark, asterisk, backslash, and open bracket. It cannot contain two consecutive dots, a double slash, a leading or trailing slash, or end with .lock. The name cannot be HEAD, cannot contain @{, and cannot end with a dot. These constraints come from git check-ref-format and prevent references that Git itself will refuse to create.

    The convention checks are optional and configurable. Choose which prefixes are allowed, such as feature, fix, chore, hotfix, and release. The validator expects the prefix followed by a slash. Ticket matching uses a regular expression; the default recognizes identifiers such as PROJ-142. The lowercase rule ignores the ticket match, so feature/PROJ-142-add-login passes even though the ticket contains uppercase letters. Hyphen rules reject repeated hyphens, leading or trailing hyphens in each segment, and, when enabled, underscores.

    The suggestion engine starts from your input, keeps or adds a valid prefix, inserts a placeholder ticket when one is required and missing, converts unsafe characters to hyphens, collapses repeated separators, applies the lowercase rule to the description, and trims the result to the maximum length. The suggestion is a starting point: replace PROJ-123 with the real ticket key before creating the branch. Configuration is not saved, and nothing is sent to a server.

    How to use this tool

    1. Type or paste a branch name.
    2. Choose allowed prefixes and enable the ticket, casing, and separator rules.
    3. Adjust the maximum length and review each pass or fail result.
    4. Copy the suggested branch name if the validator proposes a fix.

    Frequently asked questions

    Does this rename my branch?

    No. It only checks text. Use git branch -m new-name to rename a local branch, then push it and update any open pull request.

    Why does a valid branch fail the ticket rule?

    The ticket pattern is a regular expression and must match somewhere in the name. Check the pattern, or disable the requirement if the branch is not tied to a ticket.

    Can I use slashes in branch names?

    Yes. Slashes are allowed and commonly separate the prefix from the description. Consecutive slashes and leading or trailing slashes are rejected.

    Sponsored
    Find a bug? Report now