Trunk-Based Development
What is Trunk-Based Development?
Trunk-based development is a source control practice in which developers merge small changes into a single main branch, called the trunk, at least daily, avoiding long-lived feature branches.
Updated November 2026 · 2 min read
Trunk-based development is a way of using source control in which all developers merge small changes into a single main branch, called the trunk, at least once a day. Branches, if used at all, are short-lived, lasting hours or a day or two. Unfinished work is hidden behind feature flags rather than kept on a separate branch. The trunk is always kept in a working, releasable state.
It contrasts with branching models such as Gitflow, published by Vincent Driessen in 2010, which use long-lived develop, feature and release branches. Gitflow was widely adopted, and Driessen himself later added a note recommending simpler workflows for teams doing continuous delivery of web applications.
Trunk-based vs. long-lived branches
| Trunk-based development | Long-lived feature branches | |
|---|---|---|
| Branch lifetime | Hours to a day or two | Days to weeks |
| Merge conflicts | Small and frequent | Large and painful |
| Integration | Continuous | Late, often before release |
| Unfinished features | Hidden with feature flags | Kept on branches |
| Fit with continuous delivery | Strong | Weak |
Benefits of trunk-based development
Research from the DORA program found that teams using trunk-based development, with few active branches that last less than a day and no code freezes, tend to achieve higher delivery performance. It is a key enabler of continuous integration: code cannot be continuously integrated if it lives on separate branches for weeks.
What you need for trunk-based development
- Small changes: work broken into pieces that can be merged safely each day.
- Fast, reliable automated tests on every merge.
- Feature flags to hide incomplete work.
- Quick code review, or pair programming, so changes do not wait.
- Discipline to keep the trunk working at all times.
An example
Consider a hypothetical team whose feature branches typically live for three weeks. Before each release, a developer spends two to three days merging branches and resolving conflicts, and bugs introduced by merges often reach production. The team adopts trunk-based development: each developer merges to the trunk at least daily, new features start behind flags and pull requests are kept small enough to review in under 20 minutes. Merge days disappear, and because each merge is small, the team can tell exactly which change broke a test.
Common pitfalls
- Merging to trunk without enough automated testing, which breaks the trunk often.
- Large pull requests that sit in review for days.
- Leftover feature flags that are never removed.
Trunk-based development supports continuous delivery and shows up in DORA metrics through shorter lead times.
Frequently asked questions
What is the difference between trunk-based development and Gitflow?
Gitflow, published by Vincent Driessen in 2010, uses long-lived develop, feature and release branches. In trunk-based development, developers merge small changes into a single main branch at least daily, and any branches last hours or a day or two. That keeps merge conflicts small and integration continuous. Driessen later recommended simpler workflows for teams doing continuous delivery of web applications.
How do you hide unfinished work in trunk-based development?
Unfinished work is hidden behind feature flags rather than kept on a separate branch. Code merges into the trunk daily and can even be deployed while the flag keeps the feature switched off for users. The cost is housekeeping: flags left in place after a feature launches are a common pitfall and should be removed.
What do you need before adopting trunk-based development?
Trunk-based development needs work broken into pieces small enough to merge safely each day, fast and reliable automated tests on every merge, feature flags for incomplete work, and quick code review or pair programming so changes do not sit waiting. Above all, the team needs the discipline to keep the trunk working and releasable at all times.
Related terms
Feature Flags
Switches that turn features on or off without deploying new code.
Continuous Integration (CI)
Merging code often, with every change built and tested automatically.
Continuous Delivery (CD)
Keeping software always releasable so any change can ship on demand.
DORA Metrics
Five measures of how fast and how safely software reaches production.