Git Branch Naming Conventions
Last updated on
The Git Branching Naming Convention article is an excellent base. However, you can simplify even more.
Git branch names should be clear and follow this format: category/ticket-number_short-description
. Here’s how it works.
Step 1: Pick a Category
Start with one of these:
- feature: Adding, tweaking, or removing a feature.
- bugfix: Fixing a bug.
- hotfix: Fast, urgent changes (might be temporary or skip the usual process).
- test: Experimenting, no specific issue or ticket.
- refactor: Reworking code for better structure, no feature changes.
- wip: Work in progress, not ready for review or merge.
- style: Updating formatting, visuals, or UI polish.
- docs: Writing or editing documentation.
- build: Tweaking build scripts or tooling.
- ci: Adjusting continuous integration setup or pipelines.
- perf: Improving performance or speed.
Step 2: Add the Jira Ticket Number
After the category, add a "/" and the ticket or issue number (like "ticket-42"). If there’s no ticket, use empty.
Step 3: End with a Short Description
Add an underscore "_" followed by a brief, kebab-cased description (words-separated-by-dashes). Keep it short and clear—summarize the branch’s purpose. If there’s a ticket, you can adapt its title, replacing special characters with "-".
Examples
- Adding a feature: feat/ticket-42_create-new-button-component
- Fixing a bug: fix/ticket-342_button-overlap-form-on-mobile
- Rushing a fix: hotfix/no-ticket_registration-form-not-working
- Refactoring code: refactor/ticket-88_simplify-auth-logic
- Work in progress: wip/no-ticket_new-dashboard-layout
- Styling: style/ticket-15_update-button-colors
- Documentation: docs/ticket-99_add-api-guide
- Build tweak: build/no-ticket_fix-docker-config
- CI update: ci/ticket-77_add-lint-step
- Performance boost: perf/ticket-55_optimize-image-loading
That’s it—simple, consistent, and easy to scan.