GIT Branching — Naming Convention and Guidelines

Hirosh Tharaka
2 min readNov 21, 2024

--

A consistent Git branch naming convention makes it easier to understand the work being done in a particular branch when team members are working together. Additionally, it facilitates finding a specific branch within a repository.

Below, we explore some best practices for Git branch naming conventions. Hope the following will be useful to to skyrocket the efficiency.

Guidelines to follow;

  1. Name format: It is preferable to construct the branch name format in a sequence that includes the feature name, feature id, project code, and branch type.
    - For example, feature/project-a/loginor feature/project-a/jira-id-1932'.
  2. Forward Slash Separator: Use the forward slash separator to separate the branch type, project-code, and feature id, just like you would in URLs or file paths. When viewed from an IDE such as IntelliJ, this will aid in the construction of the branch tree.
    - For example, feature/project-a/loginor feature/project-a/jira-id-1932'.
  3. Kebab Case: One of the most readable ways to combine several words into one is the kebab case. All the words will be in lowercase, and each word will be separated by a dash aka hyphen. You should have encountered this case in the URLS mostly.
    - For example, feature/transfer-customer

    Note: It is acceptable to use uppercase to match the JIRA project ID in the branch name if a JIRA ID is to be used.
    - For example, feature/USAID-2456
  4. Alpha-numeric Characters: Avoid the usage of white spaces, special characters (except for hyphens, full-stop) within the branch name, or the usage of just numbers for the branch name
    - For example, purchase history,transfer-cx's-id , release/v2.1or 24566
  5. Avoid continuation of hyphens:
    - For example, add--new--customer
  6. Avoid preceding or tailing hyphens:
    - For example, -customer-delete or customer-amendment-
  7. Descriptive, But Short, and Sweet: The feature name must be brief and accurate in addition to being informative. Steer clear of long branch names.
    - For example, customer-type-premier-update-with-validation-a-and-c
  8. Avoid using Author names: To help you identify your branch, don’t enter your name or the initials of the name.
    - For example, jira-id-1231-alex or joanna-payment-feature'

Conventional examples based on different use cases/branch — prefixes;

  1. Master Branch: master
  2. Development Branch: develop
  3. Release Branch: release/project-code/[tag-version]
  4. Feature Branch: feature/project-code/[feature-name] or feature/project-code/[feature-id]
  5. Hotfix Branch: hotfix
  6. Fix/Bugfix Branch : fix/defect-9833 or bugfix/login-error
  7. Documentation Branch: doc/intergration-details or doc/api-endpoints
  8. Temporary Merging Branch: merge/[merge-name]

Even though the system itself does not enforce branch naming conventions, they are essential for keeping a clear and intelligible codebase, particularly when working in a team. You can make sure that your branches are easily recognized by adhering to these conventions.

--

--

Hirosh Tharaka
Hirosh Tharaka

Written by Hirosh Tharaka

BSc(Hons), CSM®, ISTQB® (CTFL, CTAL-TTA, CTAL-TM) | Technical Writer | Technical Tester (QA Lead)

No responses yet