Protego field desk
Source Control Strategy · 10-15% of exam

L4. Branching Strategies: Trunk-Based, Feature Branch & Release Branch

Course outlineLesson 4 of 18
AZ-400 Exam Prep: course overview

Trunk-based development with feature flags supports frequent integration, but feature branches and release branches still have their place: know when each strategy fits.

Trunk-Based Development: Continuous Integration at Its Core

Trunk-based development keeps integration frequent and changes small. Instead of long-lived feature branches, developers commit small, frequent changes directly to a single trunk (or main) branch, or to short-lived branches (hours, not weeks) that merge back quickly.

The key insight is this: instead of hiding incomplete work behind a long-lived branch, trunk-based development uses feature flags (runtime conditionals) to hide unfinished features from users. A feature flag lets code merge to main even if the feature isn't complete yet, because the flag keeps it disabled in production.

The benefit is significant. Merging small changes frequently means merge conflicts are small and resolution is fast. Large merge conflicts happen when branches diverge for weeks; frequent integration reduces that risk but does not eliminate conflicts.

Feature Branch Workflow

Feature branch development assigns each change (feature, bugfix) to its own branch off main. The branch lives as long as the feature takes, then a pull request brings it back to main after review and testing.

This works well for teams still building strong testing and CI practices. The branch is a safe place to develop without affecting main. But the longer a branch lives, the higher the risk of merge conflicts. If three developers each have a feature branch living for two weeks, by the time they merge, each one might have significant conflicts to resolve.

Feature branches suit teams practicing shorter, focused development cycles where most branches merge within days, not weeks.

Release Branch Strategy

A release branch is cut from main at release time. This branch receives only stabilization and hotfixes; development of new features continues on main. After the release, the hotfixes are merged back to main.

This strategy is useful for software shipped in distinct releases: packaged on-premises software, mobile apps requiring app-store review cycles, or any product versioned with major.minor.patch releases.

Choosing Your Strategy

StrategyDeployment FrequencyBest ForTrade-Off
Trunk-BasedIndependent of release scheduleFrequent integrationRequires strong CI and safe incomplete-work handling
Feature BranchIndependent of release scheduleIsolating reviewed changesHigher merge conflict risk as branches age
Release BranchVersion-specific releasesSupporting released versionsParallel maintenance of multiple branches
A team can combine trunk-based development with release branches for packaged software: main uses trunk-based practices with frequent deployments, and a release branch stabilizes each version.

Common Misunderstanding: "Trunk-Based Means Zero Branches"

This is false. Trunk-based development does not prohibit branches. It prohibits long-lived branches. A branch that lives for a few hours or a day before merging is consistent with trunk-based development. The exam tests this distinction carefully: if you see a question saying "trunk-based development requires developers to commit directly with no branches," that is a trap answer. Exam tip: Small, frequent integrations reduce merge risk. A branching strategy does not prescribe a deployment cadence. Know when each strategy fits your team's delivery model, and remember that trunk-based development is not the same as having no branches at all.

References

Continue Learning

Exam Focus Points
  • ✓Trunk-based development uses small, frequent commits to a single trunk with only short-lived branches, relying on feature flags to hide incomplete work rather than long-lived feature branches
  • ✓Feature branch workflows isolate each change on its own branch merged via pull request, but the longer a branch lives the higher the risk of a large, conflict-prone merge
  • ✓A release branch is cut from main at release time to stabilize and apply hotfixes without blocking new feature work continuing to merge into main
  • ✓Branching controls integration; release cadence also depends on testing, approvals, packaging and product needs
  • ✓Trunk-based development does not mean zero branching, it means avoiding long-lived branches; short-lived branches merged within hours or a day are still consistent with the model
Knowledge Check

1. A team wants to increase deployment frequency and reduce the pain of large merge conflicts. Which branching strategy, combined with feature flags, best supports this goal?

2. A company ships a packaged on-premises application with quarterly version releases. Which branching approach best fits stabilizing a specific version while development continues?

3. Which statement correctly describes trunk-based development?