we use Git branches to organize ongoing work to ensure that software delivery stays effective. If you use git today, there are high chances that you’re either using the famed git-flow or the more recent GitHub flow. Both these workflows depend extensively on using branches effectively — and naming a new branch is something many developers struggle with.

There are so many conventions and formats that are recommended, but at times following these conventions becomes painful in itself. Herein we outline a simple git branch naming convention that’s easy to follow, and takes care of most common use-cases.

Branch Naming Example

1. Use issue tracker IDs in branch names

Most conventions recommend leading the branch name with prefixes like hotfix-feature-chore-, or some other variant of the categorization of tasks. Practically, if you are using an issue tracker, you’re tagging the category of the task in the issue tracker anyway — in addition to much more additional context. Using these categorical prefixes, this, seems redundant at least and requires additional decision-making when naming branches at worst. Leading with the issue tracker ID is convenient, requires minimal thinking, and has more advantages:

  • The issues created in the issue tracker, in most cases, are used for tracking the team’s progress. It becomes easy to correlate the relevant working branch with each task — especially when each developer is working on many issues at the same time.

  • Searching and filtering is much easier in the issue tracker. Once you know your issue number, it becomes easy to find the branch using auto complete in the local git tree.

➜ super-secret-project git:(master) git checkout 72<TAB>
722-add-billing-module  -- Apply suggestions from code review
720-submodules-rc       722-add-billing-module  723-fix-highlighting  

#git #git branch #modern git workflows.

Git branch naming conventions
29.45 GEEK