Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M7197

Trunk-Based Development

Trunk-Based Development
TechnicalmediumSoftware Engineering
Included
account_tree

Updated 2026-08-10

Loading revision record…

Summary

A practice in which all developers work on one trunk branch and integrate frequently, avoiding the merge conflicts that long-lived branches create.

Definition

A software engineering practice in which developers commit to a single shared trunk branch and integrate their work frequently, rather than maintaining long-lived feature branches. Its core proposition is that frequent integration keeps divergence small, so conflicts are resolved while they are still cheap and defects surface early instead of at a painful merge. The qualifier is that the trunk must be protected by continuous integration and feature flags, otherwise the speed becomes chaos.

How to use

- Trunk setup: establish one shared mainline branch that every developer integrates their work into. - Small commits: merge changes frequently in small increments instead of large batches. - Quality gate: rely on continuous integration and automated quality checks to protect the trunk.

Mechanism

Branches that live for weeks accumulate independent changes to the same code, so the eventual merge must reconcile work that has already diverged. Integrating in small increments keeps the divergence near zero, which turns merging into a routine step, and continuous integration catches breakage at the moment it enters rather than at the end.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Trunk-based development replaces long-lived feature branches with frequent and small integrations into the trunk.
  • Hypothetical: A team integrates daily and resolves conflicts before they grow into merge conflicts.

Common pitfalls

  • Leaving the trunk unprotected so that broken code spreads to every developer.
  • Forcing large features into the trunk at once, or adopting the practice without continuous integration.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Branching_(version_controlZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS