Tech Corner

4 GIT branching strategies that you definitely need to know!

Engati Team
last edited on
November 28, 2023
3-4 mins

Table of contents

Automate your business at $5/day with Engati

Switch to Engati: Smarter choice for WhatsApp Campaigns 🚀
GIT branching strategy

What are GIT branching strategies?

GIT branching strategies are patterns or approaches that tech teams use to organize & manage their code through different branches in a GIT system.

Each strategy defines the rules & guidelines for the creation, naming & merging the branches for facilitating collaboration, stability, & release management.

In this article, we're going to discuss  git branching strategy best use cases, hands-on on git, as well as the git branching strategies we follow. Along with recommendations on how to use git to accomplish work in a consistent and productive manner.

GIT commands

To create a copy of a git repository from the remote source to your local also set the remote to the original source so that you can pull/push on the same repository.

git clone <remote origin="" url=""></remote>

To create a new branch from an existing branch with preserve the uncommitted/stash changes.

git checkout -b <branch_name></branch_name>

To check all the branch's revisions in your local system also helps in finding out which branch is currently active.

git branch

To add content from the working directory into the staging area (or “index”) for the next, commit.

git add -p

Create a new commit containing the current contents of the index and the given log message describing the changes

git commit -m <commit message=""></commit>

To publish locally committed changes to origin.

git push origin <branch name=""></branch>

To fetch & merge changes from origin to your local branch.

git pull origin <branch name=""></branch>

To record the current state of the working directory and the index, but want to go back to a clean working directory.

git stash

To list all the recorded index of the working directory/repository.

git stash list

It does the same but leaves it in the stash stack.

git stash pop

To apply the top stashed element to your current working branch/directory and remove it from the stack

git stash apply

To view commit history with SHA for current active branch

git log

To reset the active branch head to a particular commit or branch.

git reset — hard <commit sha="" branch="" name=""></commit>

What are the different GIT branching strategies?

Here are some commonly used git branching strategies:


Master branch

This is the main branch and one of the repository in which we have the latest stable code of production.  

General rules:

- Access to direct merge is restricted

- Best practice is to create a CI/CD pipeline to merge code into this branch after deployment is done in Production

- It should always have the latest stable version of production server

- Allow access to only CD tools like Jenkins to make commits to this branch

The master branch should never have unreleased code, i.e., commits made but not yet released.

Integration branch

This is the most important and active branch of the repository from which we make releases to the production server.

General rules:

- Access to direct merge is restricted

- Code is merged into this branch when it becomes eligible for production deployment

- Code in this branch should always be in a deployable state to production

- QA tested code should be into this branch using CI/CD tools

Ideally, the Integration branch should also never have unreleased code, some time on the deployment day when the code is merged a few hours before deployment time.

Staging branch

This is another stable branch of the repository for QA-environment from which we make releases to the QA server.

General rules:

-Access is restricted

-Changes can be submitted only through Pull Requests. No direct commits are allowed

-Should always have the latest stable/released version of QA release server

-It is absolutely necessary to ensure only dev tested and reviewed code gets merged into this branch

Prior to production deployment, all the feature changes must get merged in staging and validated on QA. Once validation is completed, we'll raise another MR towards the integration branch.

Dev-deploy branch

This branch will be used primarily for deploying on-going development work to the Dev environment. Since multiple teams may work on different features, projects and bugs at the same time, all of them need a Dev environment to test the changes before moving to QA. The idea of the Dev-deploy branch is to merge multiple feature branches to a common branch and deploy the same.

This is so that everyone can use a shared development environment at the same time to validate changes.


Feature deployment


Bugfix deployment


Centralized Workflow

  • There's typically a single main branch in this strategy where developers commit directly.
  • Generally used for small projects for a small set of contributors.
  • Collaboration happens by committing changes directly to the main branch.

Feature Branch Workflow

  • The developers create a separate branch for each feature that they're working on.
  • Each feature branch is independent & can be developed and tested without disturbing the main branch.
  • Collaboration occurs by merging feature branches into the main branch.


  • It is a branching strategy in GIT that defines specific branches for various stages of development.
  • It includes main branches for production-ready code, and other branches for on-going development.
  • Feature, release and hotfix branches are used to facilitate collaboration.

Forking workflow

  • This strategy is generally used in open-source projects.
  • Each developer creates their own fork (copy) and they work on changes in separate branches.
  • Collaboration happens through pull requests.

Trunk-based Development

  • There's a single main branch representing the current state of application.
  • Integration & deployment practices are continuous for ensuring stability.

Release Branching

  • This involves creating a separate branch for preparing releases.
  • Bug fixes & release-specific changes are implemented in the release branch while the main branch remains unaffected.

Do’s and Don’ts for your GIT branching strategy?

With so many GIT strategies, be careful with a couple of things:


  • Make sure to create a new branch for every new feature and bug from staging/integration.
  • Frequently commit and push changes to the remote branch to avoid loss of work.
  • Include a gitignore file in your project to avoid unwanted files getting committed.
  • Ensure that you commit changes with a concise and useful commit message.
  • Keep your branch up to date with development branches.
  • Make sure to create a MR for merging changes from one branch to another one.
  • Conduct a self-review of your code before you create a MR or send it for review to your colleagues.


  • Do not ever take pull in your feature branch from Dev deploy branch. People tend to do this while they are resolving conflicts from the Dev deploy branch.
  • Never commit directly to the Dev deploy branch.
  • Avoid holding up working by failing to commit local branch changes to remote branches. You could end up losing your work if your system crashes.
  • Do not work on several features or issues in the same branch. It becomes hard if you need to drop one feature and deploy another feature at any point of time.
  • Never reset a branch without committing or stashing your changes. If you do that, you will lose your changes.
  • Try not to revert a MR which is already merged.

To sum it up

We hope this article will help you use git in a more productive manner and assists you with your branching strategy in GIT. Another tool that boosts productivity are chatbots. Get started with an Engati Chatbot today!

Engati Team

At the forefront for digital customer experience, Engati helps you reimagine the customer journey through engagement-first solutions, spanning automation and live chat.

Close Icon
Request a Demo!
Get started on Engati with the help of a personalised demo.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
*only for sharing demo link on WhatsApp
Thanks for the information.
We will be shortly getting in touch with you.
Oops! something went wrong!
For any query reach out to us on
Close Icon
Congratulations! Your demo is recorded.

Select an option on how Engati can help you.

I am looking for a conversational AI engagement solution for the web and other channels.

I would like for a conversational AI engagement solution for WhatsApp as the primary channel

I am an e-commerce store with Shopify. I am looking for a conversational AI engagement solution for my business

I am looking to partner with Engati to build conversational AI solutions for other businesses

Close Icon
You're a step away from building your Al chatbot

How many customers do you expect to engage in a month?

Less Than 2000


More than 5000

Close Icon
Thanks for the information.

We will be shortly getting in touch with you.

Close Icon

Contact Us

Please fill in your details and we will contact you shortly.

This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
Thanks for the information.
We will be shortly getting in touch with you.
Oops! Looks like there is a problem.
Never mind, drop us a mail at