Trunk-Based Development
Single mainline; short-lived branches.
Idea
Most software teams have a Git workflow built around long-lived feature branches: the developer creates a branch, works on it for days or weeks, eventually opens a PR, deals with merge conflicts, and finally lands on main. Trunk-based development inverts this: there is one mainline, branches are short-lived (hours, not weeks), and integration happens continuously rather than at the end. The model is what makes high-velocity engineering organizations actually high-velocity.
What trunk-based development actually means:
- Direct to main.: Engineers commit small changes directly to the main branch (or to short-lived branches that merge within hours). The main branch is always the source of truth and always deployable. There is no "develop" branch, no "release" branch, no integration branch that lives parallel to main for weeks.
- Branch lifetime measured in hours.: A branch exists from the moment it is created to the moment it is merged. The interval is usually under a day, often under an hour. Long-lived branches are the source of integration pain; trunk-based development eliminates them by definition.
- No long-running feature branches.: A feature that takes a month to build still ships in pieces, each piece on its own short-lived branch. The pieces land behind a feature flag that keeps them invisible until ready. There is no "release branch" that integrates the feature at the end.
- Continuous integration in the literal sense.: Every commit to main is an integration. The team is integrating constantly, not occasionally. Conflicts surface immediately and small; nobody waits weeks to discover their work conflicts with someone else's.
- Pair with continuous deployment.: Trunk-based development is most powerful paired with CD: every commit to main automatically deploys (after CI gates). The shipping rhythm becomes "engineer commits, change is in production within an hour." This is what high-velocity teams actually look like.
The model is simple to describe and demanding to operate. Most teams that adopt it report higher velocity, lower defect rates, and dramatically less integration pain. The cost is the discipline required to maintain main as always-deployable.
Benefit
The benefits of trunk-based development compound across the engineering lifecycle. Faster feedback, fewer conflicts, higher confidence in main, and a deploy rhythm that no long-branch model can match.
- Always-deployable trunk.: Main is always green, always tested, always ready to ship. Hot fixes can be cut from main at any time without coordinating with feature work in progress. The deploy cadence is set by the team's tolerance, not by integration pain.
- Fast integration.: Conflicts surface within hours of being created, when both authors still remember what they were working on. Resolving a one-day conflict takes minutes. Resolving a four-week conflict takes hours and is error-prone. The trunk model keeps every conflict small.
- Less merge hell.: The traditional GitFlow model requires merging release branches back to develop, develop branches back to main, hot-fix branches up multiple paths. Each merge is risky. Trunk-based development has one branch hierarchy and one merge direction; there is nothing to mix up.
- Smaller PRs.: Short-lived branches contain small changes by construction. The PR review takes minutes. Reviewers actually read the diff. Bugs caught in review are fixed before merge instead of in production. The smaller batch size compounds with everything else.
- Higher deploy frequency.: Teams on trunk-based development typically deploy multiple times a day per service. The high-performing organizations in the DORA research deploy hundreds or thousands of times per day. This rate is structurally impossible with long-lived feature branches.
The benefits are real and measurable. Engineering organizations that have switched from feature-branch to trunk-based development almost universally report higher velocity and lower incident rate within a quarter.
Require
Trunk-based development is not free. It requires specific engineering disciplines that most teams need to invest in before adopting. Trying to do trunk-based development without these prerequisites produces a broken main branch and a worse developer experience than where they started.
- Strong CI.: Every commit to main is automatically tested before being accepted. The CI must be fast (sub-10-minute), reliable (low flake rate), and comprehensive (covers the cases that matter). Without strong CI, trunk-based development means main is broken half the time.
- Feature flags for in-progress work.: Code that is partway through development lands behind a feature flag with the flag off in production. The code is in main; it is not visible to users. This is what enables shipping a partially-complete feature in many small commits over weeks while keeping main always-deployable.
- Test coverage discipline.: The test suite has to actually catch regressions. A change that breaks a feature should fail a test, not slip through. Coverage floors enforced at the PR level are part of the prerequisite, not a separate discipline.
- Fast rollback.: When a bad change does land on main, the team can roll back within minutes. Auto-rollback on burn-rate breach. Manual rollback as a one-button operation. The rollback speed is what gives the team confidence to ship continuously.
- Without prerequisites, trunk breaks.: A team without strong CI, without feature flags, and without fast rollback will produce a broken main branch the first time something goes wrong. Trunk-based development is not the start of the discipline; it is the end state of mature engineering practices.
Trunk-based development is the engineering rhythm that high-performing organizations converge on. The prerequisites are real, the transition is non-trivial, and the result is dramatically better velocity. Nova AI Ops tracks the metrics that matter for trunk-based development (PR size, merge cadence, CI duration and reliability, rollback time) and surfaces the leading indicators that distinguish a team operating it well from a team struggling against it.