Skip to content

Branching models

A branching model is the agreement a team makes about how code flows from a developer’s machine to production: which branches exist, how long they live and how changes get merged. The model shapes how often a team can release and how painful each release is.

GitFlow GitHub Flow Trunk-Based Development
Main branches main + develop main main (the trunk)
Work branches feature/, release/, hotfix/ Short-lived feature branches Very short-lived, or none
Releases Versioned, planned Every merge can go out Many times a day
Works well for Versioned products, several versions in support Web apps and services with continuous deployment High-performing teams with strong automation
Watch out for Long-lived branches, painful merges, slow delivery Needs good tests and reviews on every pull request Needs feature flags and fast, reliable pipelines

Whatever the model, a few practices separate healthy repositories from risky ones:

  • the default branch is protected: no direct pushes;
  • every change goes through a reviewed pull request with a passing build;
  • work branches are short-lived and follow a naming convention;
  • release and environment branches are merged back, so fixes are not lost.

The model a team says it follows and the one its repositories show are often different, and the difference is where delivery problems hide.

Long-lived branches mean bigger merges, more conflicts and less frequent releases. That is why shorter-lived branches are associated with better DORA metrics: faster lead time and higher deployment frequency.

Branching detects the model each repository really follows, recommends one for your team and gives each repository a checklist of what to change first.