Are you aware of how branching works? if not then it’s very crucial to understand the concept of branching before we understand the strategy of GIT branching.
Branching is separation from the mainstream or main Master. so you must be thinking what is this separation from the master, why not we may continue to work from the last version of the code Right?
So, Branching allows you to work on a new breaking feature or some new functionality if your organization decides to bring it along with the existing functionality which is already delivered to the customer.
GIT Branching Strategy
GIT Branching Strategy involves 3 stages, Master, Features, and Release, which is considered to be the ideal strategy to deliver any new feature to the customer without impacting the existing delivered solution.
Master Branch
The Master Branch is the main branch where continuous code development is going on.
Feature Branch
The Feature branch is created whenever there is a new feature development is required, so let’s say if 5 developers will be working on an X new feature in the product so they will work separately in the feature branch which is separate from the main branch and all the testing and bug fixes happen in this branch and once all testing is done then feature branch is merged with Main Branch.
Release Branch
A release branch is used to deliver the code to the customer, so we build from this release branch and deliver the new functionality from this release branch.
So you may have questions like, why do we need to release a branch for delivering the feature to customers and why not from the Main branch? Because the main branch might be used for ongoing development and you would not required to break anything there.
Hot Fix Branch
A hot Fix branch is created when a developer wants to fix any critical production issue. this branch will ideally be live for like 2 or 3 days based on the bug fix, the developer will fix the code and move the code to the release branch for further testing and deploying to production, and also code is merged with the master branch to sync the code.
Note: All the code changes should be merged with the Master branch to keep the master branch up to date.