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 · 5 min read
How a team uses branches in version control has a surprisingly large effect on how fast it can deliver. When developers work on long-lived feature branches, their changes drift apart, merges become slow and risky, and finished work waits for a release branch to be cut and stabilized. Trunk-based development takes the opposite approach. Everyone works off a single main branch, called the trunk, and merges small changes into it at least once a day. Any branches that do exist are short-lived, usually lasting hours or a day or two, so the trunk is always close to what everyone is working on. Small teams may commit directly to the trunk, while larger teams typically use short-lived branches with quick code review before merging.
The practice has been used at large technology companies for many years and is described in detail by Paul Hammant and others. It contrasts with branching models such as Gitflow, published by Vincent Driessen in 2010, which use long-lived develop, feature and release branches. DORA research has found that trunk-based development, with few active branches and frequent merges, is associated with higher delivery performance. For developers, tech leads and engineering managers, it is one of the most practical changes a team can make to speed up delivery.
Definition of Trunk-Based Development
Trunk-based development is a version control branching model in which all developers integrate their work into one shared branch frequently, with any feature branches kept small and short-lived, and with unfinished features hidden behind feature flags rather than kept on separate branches.
It is closely tied to continuous integration, depends on feature flags to manage incomplete work and supports continuous delivery.
How It Works
Developers break work into small changes that can be merged safely, often several per day.
Changes are merged directly to the trunk or through short-lived branches with pull requests that are reviewed quickly.
Every merge triggers automated builds and tests, so the trunk stays healthy.
Features that are not ready for users are merged behind flags and switched on when complete, so code can be integrated before it is released. Releases are made from the trunk itself, or from short-lived release branches cut from it when a fixed version is needed.
Trunk-Based Development vs Gitflow
Gitflow uses a long-lived develop branch, feature branches for each feature and release branches for each version. It suits software released in distinct versions, such as packaged products.
Trunk-based development uses one main branch and very short-lived branches. It suits services that are deployed continuously.
The main difference is how long work stays apart. In trunk-based development, changes are integrated within a day; in Gitflow, they may stay apart for weeks. Some teams that ship versioned software still use trunk-based development, cutting release branches only at the last moment and fixing bugs on the trunk first.
Importance of Trunk-Based Development in Delivery and Engineering Operations
Trunk-based development reduces merge pain. Small, frequent merges rarely conflict, and when they do, the conflicts are small and easy to resolve.
It keeps code releasable. Because all work is integrated and tested continuously, the trunk can be released at any time without a stabilization phase.
It also speeds up feedback. Developers see each other's changes within hours, so design problems and duplicated work are spotted early. It simplifies the branching model itself. With one main branch, there are fewer rules to remember and fewer places for changes to get lost.
Trunk-Based Development and Financial Management
Less time spent resolving merge conflicts and stabilizing release branches means more engineering time for new work.
Finished work reaches customers sooner, shortening the time before development spending produces value.
Smaller changes reduce the cost of defects, since each problem is easier to find and fix.
Feature flag tools and stronger test automation may require investment, which is usually repaid through faster, more reliable delivery.
Common Challenges
Teams without good automated tests may break the trunk often. Strong continuous integration is a prerequisite.
Developers used to large feature branches need to learn to split work into small, safe steps, which takes practice.
Feature flags that are never removed create clutter and technical debt. Teams should remove flags once features are fully released. Code review can become a bottleneck if reviewers are slow, so teams need to treat reviews of small changes as a priority.
How to Adopt Trunk-Based Development
Adopting trunk-based development involves strengthening automated testing, shortening branch lifetimes, speeding up code review, introducing feature flags and tracking integration frequency.
Many teams move gradually, first limiting branches to a few days and then shortening them further as confidence grows.
Preparing the Team
Make sure every merge triggers a fast, reliable build and test run, so problems are caught immediately. Agree that a broken trunk is fixed or reverted within minutes, since everyone depends on it.
Agree on a maximum branch lifetime, such as one or two days, and make it visible when branches exceed it. Tooling can flag old branches automatically so nobody has to police them by hand.
Set expectations for quick code review, since pull requests waiting a day for review defeat the purpose. Keep pull requests small, often under a few hundred lines, so they can be reviewed in minutes rather than hours.
Working in Small Steps
Teach techniques for splitting work, such as building a feature behind a flag or adding new code paths before removing old ones.
Introduce a feature flag system and a process for cleaning up flags after release.
Track how often each developer merges to the trunk and how long branches live, and review the results in retrospectives. Watch DORA metrics such as lead time for changes, which usually fall as branches get shorter.
Examples of Trunk-Based Development in Practice
The examples below show trunk-based development in practice.
Both use illustrative figures. The first replaces long-lived branches, and the second removes a release branch.
In each, integrating sooner made delivery faster and less stressful.
Replacing Long-Lived Branches
A product team's feature branches last an average of 11 days, and the day after a sprint ends is spent resolving conflicts.
The team adopts feature flags, limits branches to two days and commits to reviewing pull requests within four working hours.
Within two months, average branch life falls to under a day, and the post-sprint merge day disappears. Developers also report that reviews are easier, because each pull request is small enough to understand in one sitting.
Removing a Release Branch
A web platform cuts a release branch every two weeks and spends three days stabilizing it before each release.
Moving to trunk-based development with feature flags lets the team deploy from the trunk whenever builds pass.
Stabilization work disappears, and the team moves from releasing every two weeks to releasing daily.
Conclusion
Trunk-based development is a practice in which developers merge small changes into a single main branch at least daily, keeping any branches short-lived and hiding unfinished work behind feature flags. It contrasts with branching models that keep work apart for weeks.
In delivery and engineering operations, trunk-based development reduces merge pain, keeps code releasable and speeds up feedback. Strengthening automated tests, limiting branch lifetimes, reviewing quickly, splitting work into small steps and managing feature flags help teams adopt it successfully.
Related terms
Continuous Integration (CI)
Merging code often, with every change built and tested automatically.
Feature Flags
Switches that turn features on or off without deploying new code.
Continuous Delivery (CD)
Keeping software always releasable so any change can ship on demand.
DORA Metrics
Four measures of how fast and how safely software reaches production.