← All posts
Julien Delange Monday, January 9, 2023

Git Branch Naming Conventions

Share

AUTHOR

Julien Delange, Founder and CEO

Julien is the CEO of Codiga. Before starting Codiga, Julien was a software engineer at Twitter and Amazon Web Services.

Julien has a PhD in computer science from Universite Pierre et Marie Curie in Paris, France.

See all articles

At Codiga, we use a consistent Git branch naming scheme. It allows us to

  • track who authored the branch (e.g. which developer)
  • trace the branch with an issue in our issue tracker (JIRA in our case)
  • have a rough idea of what the branch is about (e.g. bugfix, feature, etc)

In this article, we explain our Git branch naming convention and give some general guidelines we follow to name our branches.

Git Branch Naming Convention

Out Git branch naming convention uses the following elements:

  • submitter name: use the submitter name to identify who authored the branch.
  • identifier from issue tracker: identifier to trace the issue on our issue tracker (JIRA) so that we can easily trace a code change with our issue tracker.
  • short description: three to six keywords that explains the changes

Git naming conventions

Adding the submitter name allows you to track multiple branches for the same ticket. If Julien and David both developed a solution for ticket 1234, we can have branches julien/1234-new-feature and david/1234-new-feature and clearly trace the code pushed by each developer.

Adding a short description allows you to distinguish multiple branches for the same ticket in your issue tracker. Imagine that you have one task that requires two changes: change the color of a box and change the width of a page. You can then create two branches: developer/1234-change-color and developer/1234-change-width-page.

Git Branch Naming Good Practices

Git is a version control system that allows developers to track changes to their codebase and collaborate with other team members. One key aspect of using Git effectively is establishing a consistent naming convention for branches. In this blog post, we will explore four key considerations when it comes to naming branches in a Git repository.

  • Use descriptive names: One of the main benefits of using Git is that it allows you to track the history of your codebase. As such, it is important to choose names for your branches that accurately reflect the changes that are being made. For example, instead of using a name like "new_feature," you might use a name like "add_user_authentication." This will make it easier for you and your team to understand the purpose of the branch and the changes it contains.
  • Follow a naming convention: to ensure that branches are named consistently, and use a naming convention like the one mentioned above.
  • Use short, concise names: it is important to be descriptive, but you need to keep your branch names short. Long, verbose names can be difficult to read and may not be as effective at conveying the purpose of the branch. Use a few key words separated by hyphens for the name.
  • Avoid using special characters: avoid using special characters in branch names at all costs. Keep only alphanumeric characters. Special characters can cause issues when working with certain tools and platforms and can make it more difficult to work with branches. Stick to using alphanumeric characters and underscores to ensure that your branch names are easy to work with.

In summary, choosing descriptive, concise, and consistent names for your Git branches can help you and your team more easily track and collaborate on changes to your codebase. By following consistent naming conventions, you can ensure that your workflow remains organized and efficient.

Schedule a demo

Code analyzed in seconds with Codiga Automated Code Reviews.

Write code faster with the Codiga Coding Assistant.

Let's talk!