Branching strategies define how teams organize code changes in version control to enable parallel development, release management, and continuous integration. Trunk-Based Development (TBD) is the strategy used by Google (monorepo, 1 branch), Facebook, and Netflix — developers commit to main daily, using feature flags for incomplete work. GitFlow, popularized by Vincent Driessen in 2010, uses long-lived feature, develop, release, and hotfix branches — better suited to versioned library releases but creates integration lag. The choice profoundly affects CI/CD velocity.

Key Points

  • Trunk-Based Development: all developers commit to main (trunk) at least once per day; feature branches live <2 days; feature flags hide incomplete work.
  • GitFlow: main + develop + feature/* + release/* + hotfix/* branches; provides explicit release management but causes integration delays and merge conflicts.
  • GitHub Flow: simplified — feature branches off main, PR + review + merge; deploy from main; no develop branch needed for continuous delivery.
  • Release branching: cut a release/1.x branch from main at release time; only cherry-pick bug fixes — suitable for software with explicit versioning (SDKs, mobile apps).
  • Short-lived branches reduce merge conflict risk exponentially — a 2-day branch has 4x fewer conflicts than a 1-week branch.
  • Branch protection: require passing CI, at least 1 approving review, and linear history before merge.
  • Monorepo strategies (Google, Meta): single trunk, build system (Bazel, Buck) determines affected targets — scales to millions of lines across thousands of engineers.
  • Rebase vs merge: rebase produces linear history suitable for bisect debugging; merge preserves branch topology for audit trails.
StrategyBranch LifespanRelease ModelCI/CD SuitabilityBest For
Trunk-Based DevHours to 2 daysContinuous from mainExcellentHigh-velocity SaaS, microservices
GitHub Flow2–7 daysContinuous from main via PRGoodSmall-medium SaaS teams
GitFlowWeeks (feature), months (release)Explicit release branchesPoor (frequent merges)Versioned libraries, mobile apps
Release BranchingLong-lived release branchesPer-version branchModerateSDKs, on-prem software, iOS/Android

Real-World Example

Google's entire codebase — 2 billion lines across 500,000 engineers — runs on Trunk-Based Development in a single monorepo (Piper). Feature flags (Ganeti) are the mechanism for dark launches. This proves TBD scales to the largest engineering organization in the world.