Interview Prep/DevOps Fundamentals/Branching, versioning & releases

What is trunk-based development?

BeginnerConceptBranching, versioning & releases
Answer

In one line: Trunk-based development is a branching approach where all developers integrate small changes into one main branch (the trunk) very often — at least once a day — keeping it always releasable.

How it works:

  1. Developers create short-lived branches (hours to a day or two), or commit directly to main in very small teams.
  2. Each change is small, reviewed quickly and merged after CI passes.
  3. Unfinished features are hidden behind feature flags, so they can be merged without users seeing them.
  4. Main is always in a deployable state; releases are cut from main (or main deploys continuously).

Why it's linked to high performance: DORA research found that trunk-based development (few active branches, short-lived branches, no code freezes) is one of the practices of elite-performing teams.

Benefits:

  • No "merge hell" — small, frequent merges mean small conflicts.
  • True continuous integration — everyone's code is integrated daily.
  • Faster feedback and delivery.
  • Simpler — no complex branch structure to manage.

What it requires:

  • Strong automated tests and fast CI — main must stay green.
  • Feature flags for incomplete work.
  • A culture of small PRs and quick reviews.
  • Fixing a broken main immediately (or reverting).

Trunk-based vs GitFlow:

Trunk-based GitFlow
Long-lived branches Just main main + develop (+ release)
Branch life Hours/days Days/weeks
Release style Continuous / frequent Scheduled versions
Complexity Low High

Example: a developer adds a new search feature over a week, merging five small PRs daily behind a flag new_search=false. When finished, the flag is turned on for 10% of users.

Tip for interviews: link trunk-based development to feature flags and fast CI — those are what make it work.

All DevOps Fundamentals questions

More on Branching, versioning & releases