Skip to content
BeginnerCareer Notes

Git Commit and Branch Naming Conventions I Actually Follow

A branch name and a commit message are read far more often than they're written. Two small conventions that make a repo's history skimmable instead of archaeological.

Hen HeangJuly 11, 20265 min read
GitCode ReviewConventions

Without a naming convention, a team's branch list and commit history become confusing to navigate โ€” nobody can tell what a branch is for or what a commit actually changed without opening it. Two small, cheap conventions fix most of that.

Branch names: start with a group word

  • Regular branches are permanent: dev (changes get reviewed and tested before merging to master) and master (stable, no direct commits, merge only via review).
  • Temporary branches get created and deleted per unit of work: bug fixes, hotfixes, feature branches.
  • Prefix with a group word that matches the workflow โ€” bug- for something that needs fixing soon, WIP- for work you know won't finish soon.
  • Use hyphens or slashes as separators, e.g. bug-logo-alignment-issue.
  • Some teams prefix with the author's name instead, e.g. chantha_feature_login โ€” useful when several people work the same feature area in parallel.

Warning

Avoid branch names that are only numbers or that run too long to read in a terminal prompt. If you can't tell what a branch is for from its name alone, the name failed its one job.

Conventional Commits: one prefix, instant scanability

text
<type>: message

feat: allow provide config object to extend other configs
style: color changed in navbar

The type prefix (feat, fix, style, refactor, docs, test, chore...) turns a commit log into something you can scan for exactly the kind of change you're looking for โ€” git log --oneline | grep '^fix' actually works when the team follows this. It also unlocks automated tooling: changelogs and semantic version bumps can be generated directly from commit history because the type is machine-parseable, not just a human hint.

Best Practice

The value isn't the convention itself โ€” it's that every commit becomes self-describing without opening the diff. A reviewer scanning fix: null pointer on empty cart before opening the PR already knows more than a bare Update CartService.java ever tells them.