Branching Strategies in Git (original) (raw)

Last Updated : 2 Apr, 2026

A branching strategy defines how developers create, manage and merge branches in a version control system like Git to ensure smooth collaboration and organized code development.

Steps for Creating a Branch in Git

Step 1: Create a Branch

Create a branch with the name you want to specify. Here, we are naming the branch "new-feature".

git branch new-feature

We

Now navigate to the new feature branch from the current branch with the following command:

git checkout new-feature

or

We can use the following command that will create the branch and switch to it at the same time:

git checkout -b new-feature

Step 3: Check Current Branch

Execute the following command to check the current branch that you are currently on.

git branch

Step 4: Delete a Branch

Ensure you are on a different branch than the one you want to delete. Then run:

git branch -d

Common Git Branching Strategies

1. GitFlow Workflow

GitFlow enables parallel development, allowing developers to work separately on feature branches. A feature branch is created from a master branch and after completion of changes the feature branch is merged with the master branch.

420047070

**Note: The Master and Develop branches are the main branches that remain throughout the journey of the software. The other branches are supporting branches and are short-lived that serving specific purposes.

2. GitHub Flow

GitHub Flow is a lightweight branching strategy that keeps the main branch always deployable and supports fast, continuous development.

The types of branches that are present in GitHub Flow are:

420047071

3. GitLab Flow

GitLab flow is a scalable branching strategy that combines flexibility with continuous integration while keeping the master branch stable.

The types of branches that can be present in GitFlow are:

420047072

GitLab Flow

4. Trunk Based Development

Trunk-Based Development is a branching strategy where all developers work directly on a single main branch, keeping it always in a release-ready state.

420047073

Trunk Based Development

Picking the Right Branching Strategy

Git provides multiple branching strategies to support different team sizes, workflows and project goals and choosing the right one depends on how a team balances simplicity, control and release speed.

Product Type Team Size Applicable Strategy
Continuous Deployment and Release Small GitHub Flow and TBD
Scheduled and Periodic Version Release Medium GitFlow and GitLab Flow
Continuous deployment for quality-focused products Medium GitLab Flow
Products with long maintenance cycles Large GitFlow