By admin , 29 April 2026

Why branch names matter

Branch names are the first thing reviewers, CI systems, and future archaeologists see. A consistent convention turns git branch -a from noise into a structured catalogue. On a team of five, sloppy names are merely annoying; on a team of fifty, they cause merge conflicts, lost work, and confused reviewers.

The three-part pattern

The most widely adopted convention uses three slash-separated segments: type, identifier, short description.

git checkout -b feature/PROJ-1234-add-oauth-login
git checkout -b bugfix/PROJ-1455-fix-login-redirect
git checkout -b chore/PROJ-1502-bump-node-20

The type prefix lets tools and humans filter quickly. Common types: feature, bugfix, hotfix, chore, docs, refactor, experiment, release.

Including ticket identifiers

If your team uses Jira, Linear, GitHub Issues, or similar, embed the identifier. CI systems can then auto-link branches to tickets, and you can query git log --grep=PROJ-1234 to recover history.

git checkout -b feature/PROJ-1234-search-autocomplete

Rules that prevent pain

Adopt these rules and enforce them with hooks or CI:

  • Lowercase only - case sensitivity differs across platforms.
  • Hyphens, not spaces or underscores.
  • No trailing slashes; no leading slashes.
  • Limit length to about 60 characters - long names break terminal output.
  • Avoid personal names like jeremy/fix-thing; ownership lives in commit metadata, not branch names.

Enforcing conventions

A simple pre-push hook can reject non-conforming names:

#!/usr/bin/env bash
branch=$(git symbolic-ref --short HEAD)
if [[ ! "$branch" =~ ^(feature|bugfix|hotfix|chore|docs)/[A-Z]+-[0-9]+-[a-z0-9-]+$ ]]; then
  echo "Branch name '$branch' does not match convention." >&2
  exit 1
fi

Save this as .git/hooks/pre-push and make it executable. For team-wide enforcement, use a tool like husky or commit it to a shared hooks directory configured via core.hooksPath.

Special branches

Reserve specific names for long-lived branches: main (or master on legacy repos), develop if you use Git Flow, and release/x.y for stabilising releases. Never reuse these names for feature work.

Cleaning up

Branches accumulate fast. Delete them as soon as their PR merges:

git branch -d feature/PROJ-1234-add-oauth-login
git push origin --delete feature/PROJ-1234-add-oauth-login

Most Git hosts can auto-delete merged branches. Turn it on - your git branch -a output will thank you.