Branching thumbnail

What is a branching?


Branching is when you make a copy of the same code base and use the copy to perform your work.


Code branching is like working on a cooking recipe.

A chef will have the base recipe that they start working with. As they test out new ingredients, they will replicate the recipe and make their changes. Rather than changing the master recipe, they will duplicate the recipe to test out their new approach.

If they like the new piece of the recipe, then they will add it to the main recipe. If they don't like it, then they can discard it and go back to the original recipe. This way, their efforts of testing out new ingredients doesn't impact the base recipe itself.

In other words:

Code branching is a type of version control system in writing code, allowing developers to work on different versions of the same codebase. Once the changes have been made, a developer can merge their branch back into the main codebase, applying their changes without disrupting the workflow of others.

Why is code branching important?

It's one thing to know what branching is, but that is worthless if you don't know why you should know what branching in the first place. Let's break down the importance of this tech term based on two high level categories. We'll walk through an explanation as well as provide a score, 1-10, that shows you how much you should care about a code branch.

Pre-Product: 1/10

The first will be if you do not have a product yet. This means that you don't have a physical product. Maybe you're in the ideation phase, or maybe you're almost ready to start development. Whichever it is, we'll get into why code branching is important and why you should or shouldn't care about it if you do not have a product.

If you don't have a product, you don't need to worry about branching. Code branching is a developer habit that should be implemented once you start development itself. For now, stay focused on building the business and getting to a point where you're ready for development!

Live-Product: 8/10

The second category is if you do have a live product. Maybe you just launched your business or maybe it's been live for years and you're continuing to improve its quality. Regardless of the scenario, if your product is live, branching carries a different weight.

Branching is an incredibly important developer habit that your development team should be following. It is a standard best practice that ensures your developers are coding responsibly - you can look at a code branch as a form of risk-mitigation. While you don't need to know how to branch yourself, it is important that you understand the concept as well as know how to identify that branching is being used. As a product leader or owner, you need to make sure that proper habits are being followed.

Examples of code branching

So you know what a code branch is, by definition. You know if you should care about it or not depending on your situation as a business/company/product. To dig in deeper, we will walk through some tools and processes so we can make sure you really have a solid grasp on branching.

We're going to walk through five common types of branching that are used by developers. While this doesn't include every type of branching strategy, it does walk through the common use-cases for branching, therefor something that your developers should all be familiar with (and use!):

Feature Branching

Feature branching is when you create a branch to work on a specific feature. A developer will work on this feature (or bug in some cases) in a separate branch to keep the source code clean. Once the feature is completed, the developer will merge the branch back into the main codebase and apply their changes.

Production Branching

A production branch, also referred to as a release branch or main branch, is one that is used to prepare for a specific development release. This can sometimes be referred to a main branch or a production branch. This type of branch will allow you to release your software while still letting your developers work on the code. By having a specific release branch, you can launch new versions while still updating the code base by working on the backlog of tasks that are outlined for your developers.

Staging Branching

A staging branch is similar to a production branch, but where a production branch is used to push the live product, a staging branch is used to push the staging product. A staging branch/product is used as your final draft before pushing live. This allows you to test your product, as if it were live, one last time to ensure that when you do push it live, users are going to see the right thing and won't be hit with bugs.

Hotfix Branching

A hotfix branch is one that is used for a very specific purpose, to fix a specific issue. This tends to be a critical bug that is in production (your live product). If you have a bug that needs immediate attention, a developer will create a separate branch to work on and fix this bug, that way they do not disrupt or force other developers to stop their work.

Developer Branching

Developer branching, also referred to as experimental branching, is a method used to test out new ideas, technologies, methodologies, or features. Often times in the beginning of a project, and sometimes throughout, you want your developers to do their first effort of work in a developer branch, this way they have their own workspace to work on their tasks. Once they have a solid grasp, they can then either merge it or take those learnings and then work within a feature branch itself.

Multi-Platform Development Branching

This form of branching ensures that your codebase for different platforms stay separate. For example, if you have an iOS and Android application, you may not want to use the exact same codebase, even if you are using a compatible cross-platform technology. Often times, you will need to make unique changes to a codebase to comply with the specific platform you are releasing it on, so this ensures that you can make those specific changes without impacting the other platform's live product.

Key Takeaways:

  1. Code branching is a version control strategy used to allow different versions of the codebase be worked on at the same time. This allows developers to work on more complex projects.
  2. If you don't have a product, don't worry about what branching is.
  3. If you do have a product or are in development, be sure you know what branching is and how to identify it to ensure that your team is following branching best practices.
  4. There are many different use cases of branching, including but not limited to: feature branch, staging branch, production branch, hotfix branch, developer branch, and multi-platform branch.
Not seeing a term? 🤔