Trunk-Based Development

Paul Hammant's definition: everyone integrates to trunk daily, branches live hours not weeks, feature flags hide incomplete work.

Overview

What trunk-based development is

Trunk-based development (TBD) is the branching model where all developers commit to a single shared branch (trunk / main) at least once a day. Branches, when used at all, live hours, not weeks. The canonical reference is trunkbaseddevelopment.com (Paul Hammant, 2017+).

Hammant defines it as a source-control branching model where developers collaborate on code in a single branch called 'trunk' (in Git, the 'main' branch) and resist any pressure to create other long-lived development branches by employing documented techniques. The picture below shows what that looks like day to day.

Key concepts

  • Trunk-based development (Hammant)
  • Feature flag (Hodgson 2017)
  • Branch by abstraction
  • Git Flow (Driessen 2010)
  • GitHub Flow
  • DORA empirical evidence

Interview questions

  • Define trunk-based development and contrast it with Git Flow.
  • How do feature flags enable trunk-based development for large features?
  • How do you migrate a team off Git Flow to trunk-based development?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio