Comprehensive Guide to Branching Strategies

Admir Mujkic
7 min readMar 7, 2024


As a project grows, so does the amount of work needed for new features, releases, and urgent fixes. GitFlow is a great way to manage a project that is continually adding features, with specific release times, and it’s what we encourage for complex projects with a lot of moving parts.

GitFlow is best used in projects with scheduled releases rather than “whenever we feel like it” updates. It separates the work needed to get a release ready, support the release, and immediately move on to the next one.

It’s also best used on big projects, with some significant development that needs a clear path between development, testing, and live use, and it’s especially useful for teams with specific roles (i.e., release managers, QA engineers), as GitFlow clearly defines everyone’s tasks.

Why GitFlow

  • It gives you a nice, clean way to perform several different types of development work simultaneously.
  • It keeps the main branch’s history nice and clean and usable for anyone looking for a stable version and just doing git checkout master.
  • It allows for quick bug fixes and the like in production without pushing the more recent development work in at the same time.

When you start a new project, you first create a main branch. This is basically the final version of your project-it’s like the mansion that’s always ready to be seen by everyone, with a big sign out front. You polish the your code, and this is what you put on display. Simple!

You also have a develop branch. This is where you work on new ideas and changes, so what you want. You can think of this like the workshop you build your mansion. It’s not quite ready for the public still because under construction. This setup means only the absolute best, fully-tested updates make it from this branch to to the main one.

I believe this is very useful if you are working alone. You make changes to the developbranch, and once you’ve finally got them that you are happy, you move them to the main branch. Your project will be ready for show or to be used for end users.

Also there is possibility to be more comfortable, you can do the same thing and more branches for specific tasks. For example use a feature branch, like feature/settings. If you a find bug in production in the main branch and you need to immediately patch a few bugs, so hotfix branches are the way to go.

This keeps all of your work nice and organized. If you are working by yourself, it makes sure you always know where everything is. And if you are working as part of a big team, it makes sure everyone knows where they need to go to find different parts of your project, and how they can contribute.

GitHub Flow streamlines the process of making changes with a straightforward, step-by-step approach. It’s perfect for teams that aim to deliver updates fast and frequently.

As you can see, the process of making changes is incredibly easy, frequent updates with a step-by-step history of everyone’s work. You are asking when should I use GitHub Flow?

If you’re interested in pushing changes live frequently (or even just with standard regular updates), it can be really nice. It’s simple, so new team members can start contributing without a lot of ramp-up. And if you’re running a project that is looking to grow, using GitHub Flow definitely lowers the barrier of entry.

There are a few reasons why it’s nice:

  • This flexibility lets teams act quickly on feedback or changes in the market.
  • They are all to master. Teams can always keep a single line of development, reaping the rewards of small, frequent releases without the overhead of a complex merging process.
  • Review and testing are first class citizens. All changes are done with another set of eyes and automatically tested to be ready to go into production before they’re merged.

In the image above, we create two features and merge them into main branch, then release version 1.0.0. Right after we see an error with the text on our site that our legal team needs fixed.

A developer takes the new tasks in their hotfix branch, updates the text, goes through their normal review and approval process then updates the website separately from our main line of development.

I would like ask myself if reading this one, what makes a hotfix different from a feature branch? A hotfix is special because it allows a quick fix to be made, right from main branch, fixing the urgent issue. While feature branches allow changes to be made, in a more planned out way from development branch and are often scheduled for later releases.

Also of note is the release/branch, a critical concept to our workflow of always having our software production ready. This pattern has become increasingly popular for startups looking to remain agile.

GitLab Flow combines the best aspects of GitFlow and GitHub Flow while integrating issue tracking and environment branches. This approach offers a versatile workflow that caters to continuous deployment practices, with a focus on feature-driven development.

If you are looking for controlled, continuous deployment than when you should use GitLab Flow. It’s perfect for regular, small changes in projects that need to move through several steps and environments on the way to production.

GitLab Flow also hooks development into issue tracking, It’s great for complex deployment pipelines, when you might have several environments-development, staging, production-and need to test in multiple stages before going live.

So you now asking again why choose GitLab Flow?

It’s versatile, supporting continuous integration and deployment with specific controls for different environments. It makes managing features and bug fixes easier with integrated issue tracking and promotes thorough testing and review, so you can be confident your production code is top-notch.

So the main branch is used for testing — whether that’s testing from the QA team, or just testing a feature branch — all changes merge to master, the same as GitHub Flow. After the feature branch is committed, a code review is necessary, and after it’s merged, every test known to mankind is run. If those tests take longer than 5 minutes, make them run concurrently.

After the tests in the master branch are complete, it moves to pre-production, where it’s tested some more before it goes live in production. Every time a change is made, we’ll tag the release, and that tag will kick off a brand new release.

What if we have a bug? First, you fix it in the master branch of course. Then you will also fix it in any other branch.

A bug happens and is fixed in the master branch, the first branch. A bug is found in production, so will need to fix it in the master branch. This is the main branch, and the only time we can commit directly to it. Then we will fix it in any other branch. Every change is a new branch.

Let’s call it pre-production, and you are in charge :-). Only the master branch goes to production, and every new change we will first tag for automatic promotion, from the master branch to pre-prod let’s say infinite times, and then we will tag again for release to production.

Now we should ask pre-production and production ok with the team? This workflow involves longer term branches like the master and the environment branches this is argument why we have potentially stable product with this strategy (If you have experience, please comment bellove)?

Working together using source control tools is only one part of being efficient and efficient is exactly what you want to be as a developer, but you also need to be working well with others.

Tips for working as a good team member are spread all over the place, here and there. Some of the below advice applies to making team coding work better in general.

The rule is that you rebase when doing private work, and merge when doing public contributions. Rebase when you’re making many small changes or fixes on your private branch.

Rebase combines them all into 1 commit, so you get a clean and simple history. Merge into your public branch when your work is ready to share with your team or the public.

Merging brings your commits together, but keeps the full history of the changes. Think of rebasing since idea is to keep your main project branch neat, and to show how it gets updated with what each commit adds to it.

Use tags for versioning wisely sine they are essential for source control and give to flow own identity. Do not add tags as comments to your workflow tags are labels for specific versions of the code, and they can be useful for indicating stable releases that does not have to be changed For everything else regarding your workflow, we have labels.

Choosing between GitFlow, GitHub Flow, or GitLab Flow ultimately depends on your project’s specific demands (trade-off as always in software industry), team size, and workflow preferences. If your project has scheduled releases and requires a high degree of structure, then a branching strategy like GitFlow provides the clarity and process necessary for successful collaboration.

Alternatively, for teams creating and releasing software in a state of heightened continuous delivery, GitHub Flow is likely the best option with its extreme simplicity and speed. GitLab Flow represents a nice middle ground that supports complex deployment pipelines and integrated issue tracking while avoiding the complexity of GitFlow.

The right branching strategy will ultimately enhance team collaboration, smooth out the development process, and detail the specific steps everyone should take to help ensure your project is delivered as expected and on time.

By understanding the nuances of all three strategies and taking your project’s specific requirements into account, you can select a branching workflow that will best support your development efforts.

Good Luck :-)

Originally published at



Admir Mujkic

Admir combined engineering expertise with business acumen to make a positive impact & share knowledge. Dedicated to educating the next generation of leaders.