Trunk-Based Development
Trunk-Based Development (TBD) is a workflow where all developers integrate to a single shared branch (the "trunk" or main) very frequently — at least once per day. Feature branches exist but are short-lived, merged within hours to days. Used by Google, Meta, and Netflix.
01.Core Principles of TBD
Integrate to trunk at least once a day. Feature branches live less than 2 days — long-lived branches accumulate conflict debt. Comprehensive automated test suite is non-negotiable — trunk must be deployable at every commit. Feature flags hide incomplete work in production. Small, focused commits over large batched ones. Code review happens fast because PRs are small.
02.Feature Flags Enable TBD at Scale
Feature flags (feature toggles) let you merge incomplete code to trunk while keeping it invisible to users. The code is deployed but wrapped: if (flags.newDashboard) { /* new code */ }. This completely separates deployment (when code ships) from release (when users see it). Teams can merge daily even for multi-month features. Flags are managed via config, no code change needed to flip them.
Commands
What is the defining characteristic of Trunk-Based Development?