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
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
Feature Branch Workflow
GitFlow
Forking workflow
Trunk-based Development
Release Branching
Do’s and Don’ts for your GIT branching strategy?
With so many GIT strategies, be careful with a couple of things:
Comments
Post a Comment