← Back to Articles         
Git Branching Strategies

Git Branching Strategies

Published on 08 Oct 2026     10 min read Azure DevOps
Azure Repos

Azure Repos – Git Branching Strategies: Feature Branches, GitFlow, and Trunk-Based Development

1. What is a Git Branching Strategy?

A Git branching strategy is a set of rules that defines how developers create branches, develop features, merge changes, and manage releases in a Git repository.

Azure Repos supports different branching strategies because it uses Git as its version control system.

The three commonly used approaches are:

  1. Feature Branching – Developers create separate branches for individual features or bug fixes.

  2. GitFlow – Uses structured branches such as main, develop, feature, release, and hotfix.

  3. Trunk-Based Development – Developers integrate small changes frequently into one primary branch, usually main.

Why do we need branching strategies?

Suppose five developers are working on an ASP.NET Core Web API application.

Without a branching strategy, developers may push unfinished code directly into production, introduce integration problems, or create confusion about which version should be deployed.

A branching strategy helps teams:

  • Work on multiple features independently.

  • Protect production-ready code.

  • Control code reviews and merging.

  • Manage releases and hotfixes.

  • Reduce integration problems.

  • Support CI/CD automation.

Important: Azure Repos does not enforce one specific branching strategy. The team selects an approach and implements it using Git branches, Pull Requests, branch policies, and Azure Pipelines.

 

2. Feature Branching Strategy

What is Feature Branching?

Feature Branching is a development approach where each new feature or bug fix is developed in a separate Git branch.

The feature branch is created from a shared branch, such as main or develop.

After development, the changes are reviewed and merged into the target branch through a Pull Request.

 

How does it work?

Step 1: Update the main branch

git switch main
git pull origin main

Step 2: Create a feature branch

git switch -c feature/customer-api

Step 3: Develop and commit changes

git add .
git commit -m "Implemented Customer API"

Step 4: Push the branch to Azure Repos

git push -u origin feature/customer-api

Step 5: Create a Pull Request

In Azure DevOps:

Repos → Pull requests → New pull request

Select:

Source: feature/customer-api
Target: main

After code review and build validation, complete the PR.

Advantages

  • Developers work independently.

  • Features can be reviewed separately.

  • Production code remains protected.

  • Easy to understand and implement.

Disadvantages

  • Long-lived feature branches can create merge conflicts.

  • Delayed integration may cause compatibility issues.

  • Large Pull Requests can be difficult to review.

Best suited for: Small and medium-sized teams, and projects that need independent feature development with code reviews.

 

3. GitFlow Branching Strategy

What is GitFlow?

GitFlow is a structured branching strategy that uses separate branches for development, releases, and production hotfixes.

It is particularly useful when an application has planned release cycles and requires multiple stages of testing.

Main GitFlow branches

Branch

Purpose

main

Production-ready code

develop

Integration of completed features

feature/*

Individual feature development

release/*

Release preparation and stabilization

hotfix/*

Urgent production fixes

 

How does GitFlow work?

Step 1: Create a feature branch from develop

git switch develop
git pull origin develop
git switch -c feature/customer-api

Develop, commit, and push the changes.

After review, merge the feature branch into develop through a Pull Request.

Step 2: Create a release branch

Once the planned features are ready:

git switch develop
git pull origin develop
git switch -c release/1.0
git push -u origin release/1.0

The release branch is used for final testing, bug fixes, and release preparation.

New feature development can continue in develop.

Step 3: Merge the release into main

After successful testing:

release/1.0
     ↓
Pull Request
     ↓
main
     ↓
Production Deployment

The release changes are also integrated back into develop to ensure release fixes are retained.

Step 4: Handle production hotfixes

Suppose a production defect is reported.

Create a hotfix branch from main:

git switch main
git pull origin main
git switch -c hotfix/payment-error

Fix the issue, commit, and push.

After review, merge the hotfix into main and integrate the fix into develop or the active release branch as appropriate.

Advantages

  • Clear separation between development and production.

  • Supports planned release cycles.

  • Makes release stabilization easier.

  • Provides a defined process for production hotfixes.

Disadvantages

  • More branches to maintain.

  • Requires additional merges.

  • Can produce more merge conflicts.

  • May slow down continuous delivery.

Best suited for: Enterprise applications with scheduled releases, formal testing, and controlled production deployments.

 

4. Trunk-Based Development

What is Trunk-Based Development?

Trunk-Based Development is a branching strategy where developers integrate small code changes frequently into a single primary branch, usually main.

Developers either commit directly to the trunk or use very short-lived feature branches.

In Azure Repos, teams commonly use short-lived branches and Pull Requests to maintain code-review and branch-policy requirements.

Short-lived branches integrate frequently into the main branch

How does it work?

Step 1: Create a short-lived branch

git switch main
git pull origin main
git switch -c feature/customer-validation

Step 2: Make a small change

git add .
git commit -m "Added customer validation"

Step 3: Push and create a PR

git push -u origin feature/customer-validation

Step 4: Merge quickly

After code review and successful build validation, merge the branch into main.

Developers repeat this process frequently, often several times per day.

What about incomplete features?

Trunk-based teams commonly use feature flags to merge incomplete functionality safely without exposing it to users.

Example:

if (featureFlags.EnableNewPaymentFlow)
{
    await ProcessNewPaymentAsync();
}
else
{
    await ProcessExistingPaymentAsync();
}

The feature flag allows the new implementation to remain disabled until it is ready.

Feature flags must be managed carefully, particularly for security-sensitive functionality.

Advantages

  • Encourages frequent integration.

  • Reduces long-lived branch conflicts.

  • Supports rapid CI/CD.

  • Makes small changes easier to review.

  • Reduces integration delays.

Disadvantages

  • Requires reliable automated testing.

  • Developers must integrate frequently.

  • Incomplete functionality needs careful isolation.

  • Poorly managed feature flags add complexity.

Best suited for: Teams practicing Continuous Integration, Continuous Delivery, and frequent production releases.

 

5. Feature Branching vs GitFlow vs Trunk-Based Development

Feature

Feature Branching

GitFlow

Trunk-Based

Main branches

main + feature branches

main, develop, release, feature, hotfix

Primarily main

Feature branch lifetime

Short to medium

Often medium

Very short

Release management

Simple

Structured

CI/CD-driven

Merge frequency

After feature completion

At defined integration points

Very frequent

Merge conflicts

Moderate

Potentially higher

Generally lower

CI/CD suitability

Good

Good for scheduled releases

Excellent for continuous delivery

Complexity

Low

High

Low branching complexity; high automation discipline

Best suited for

General development

Controlled release cycles

Frequent deployments

Which strategy should you choose?

  • Feature Branching: Choose when your team wants a straightforward process for developing and reviewing features.

  • GitFlow: Choose when you have formal release schedules, multiple supported versions, or extensive release stabilization.

  • Trunk-Based: Choose when your team can maintain a reliable main branch through automated tests, small changes, and frequent integration.

Microsoft's Azure Repos guidance recommends keeping branching simple, using feature branches and Pull Requests, and maintaining a high-quality main branch.

Microsoft Learn
+1

 

 

6. How do you implement branching strategies in Azure Repos?

Azure Repos provides the same core capabilities for all three strategies.

Step 1: Create branches

Navigate to:

Azure DevOps → Repos → Branches → New branch

Create the required branches based on your strategy.

Step 2: Configure branch policies

Navigate to:

Repos → Branches → main → Branch policies

Recommended settings:

Policy

Configuration

Minimum reviewers

2

Build validation

Required

Comment resolution

Required

Direct pushes

Block through required policies

Bypass permissions

Restricted

For GitFlow, configure appropriate policies on both main and develop.

Step 3: Create Pull Requests

Developers push their feature branches and create PRs to the appropriate target branch.

Step 4: Integrate Azure Pipelines

Configure CI pipelines to build and test proposed changes.

Configure deployment pipelines based on your release strategy.

For example:

GitFlow:
feature → develop → release → main → Production

Trunk-Based:
short-lived feature → main → CI/CD → Production

In practice, production deployment may require additional approval gates even after the code has been merged.

Azure Repos supports these workflows through Pull Requests, branch policies, and repository permissions.

Microsoft Learn
+1

 

 

7. Real-Time Scenario: Banking Application

Suppose a banking application contains Customer, Account, and Payment modules.

Using GitFlow

feature/customer-api ──┐
feature/account-api ───┼──→ develop
feature/payment-api ───┘        ↓
                           release/2.0
                                ↓
                            SIT / UAT
                                ↓
                              main
                                ↓
                           Production

Here:

  1. Developers implement features independently.

  2. Completed features are merged into develop.

  3. A release branch is created for testing.

  4. Release defects are fixed.

  5. The release is merged into main and deployed.

  6. Relevant release fixes are synchronized back to develop.

This approach is suitable when the application has controlled release schedules.

Using Trunk-Based Development

Small feature changes
         ↓
Short-lived branches
         ↓
Pull Requests
         ↓
        main
         ↓
Automated Build + Tests
         ↓
Deployment Pipeline
         ↓
      Production

This approach is suitable when the team releases frequently and has strong automated testing.

 

8. Advantages and Disadvantages Summary

Strategy

Main advantage

Main disadvantage

Feature Branching

Simple isolation and code review

Long-running features may cause conflicts

GitFlow

Strong release organization

More branch and merge overhead

Trunk-Based

Fast integration and delivery

Requires disciplined automation and testing

 

9. Important Interview Questions and Answers

Q1. What is a branching strategy in Git?

A branching strategy defines how developers create, manage, and merge branches to support development, collaboration, and releases.

Q2. What is the difference between Feature Branching and GitFlow?

Feature Branching focuses on isolated development of individual changes. GitFlow adds a structured release process with develop, release, and hotfix branches.

Q3. What is Trunk-Based Development?

Trunk-Based Development is an approach where developers frequently integrate small changes into a shared main branch, either directly or through short-lived branches.

Q4. Which branching strategy is best for Azure DevOps?

Azure DevOps supports all three. The choice depends on team size, release frequency, testing maturity, and deployment requirements.

Q5. Does Trunk-Based Development support Pull Requests?

Yes. Developers can create short-lived feature branches and merge them into main through Pull Requests.

Q6. How does GitFlow handle production defects?

A hotfix branch is created from main. After fixing and testing the defect, the changes are merged into main and integrated into develop or applicable release branches.

Q7. Why does Trunk-Based Development reduce merge conflicts?

Developers integrate small changes frequently, reducing the amount of code divergence between branches.

Q8. Can GitFlow be used with Azure Pipelines?

Yes. Azure Pipelines can build, test, and deploy code from feature, development, release, and production branches according to the configured pipeline triggers.

 

10. Real-Time Interview Answer

Question: How do you use Git branching strategies in Azure Repos?

In Azure Repos, we use Git branching strategies to manage feature development, code integration, and production releases.

In a GitFlow-based project, we maintain main for production and develop for ongoing development. Developers create separate feature branches from develop.

Once development is completed, they push their changes and create Pull Requests. After code review and build validation, the changes are merged into develop.

When a release is planned, we create a release branch for testing and stabilization. After successful validation, the changes are merged into main and deployed to production.

For urgent production defects, we create hotfix branches from main and integrate the fixes into the appropriate branches.

For projects requiring frequent deployments, we can use trunk-based development, where developers merge small changes frequently into main.

We use Azure Repos branch policies, Pull Requests, and Azure Pipelines to maintain code quality and control deployments.

 

11. Key Points to Remember

  • Feature Branching: Separate branch for each feature or bug fix.

  • GitFlow: Structured development and release branches.

  • Trunk-Based: Frequent integration into one main branch.

  • Pull Requests: Review and merge changes.

  • Branch Policies: Protect important branches.

  • Feature Flags: Allow incomplete functionality to remain disabled.

  • Azure Pipelines: Automate builds, tests, and deployments.

  • Hotfix Branch: Fix urgent production defects.

  • Release Branch: Stabilize a planned release.

One-line interview answer: Azure Repos supports feature branching, GitFlow, and trunk-based development using Git. Feature branching isolates changes, GitFlow provides structured release management, and trunk-based development enables frequent integration and CI/CD through short-lived branches and automated validation.

Reference: Microsoft Learn – Git Branching Guidance.

← Back to Articles