Trunk-based development: short branches and small merges
In trunk-based development, each developer divides the work into small batches and merges into trunk at least once a day. DORA contrasts this with feature branches that take days or weeks and end in bigger, more complex merges.

One shared branch
The summary on trunkbaseddevelopment.com: developers work together on one branch, called trunk and known as main in the Git community, and hold back from creating other long-lived development branches. DORA adds the working pattern. Each developer divides the work into small batches and merges it into trunk at least once a day.
Short-lived branches and small pull requests
The trunk-based development site allows short-lived feature branches for code review and build checking. It sets these rules:
- One owner. The developer count on a branch stays at one, or two when pair programming. The branch is not shared for general development, though it may be shared for code review.
- A couple of days at most. The branch should last only a couple of days, and time spent waiting for review counts towards that life.
- One direction. Merges into the branch bring it up to date with trunk. A merge to trunk is allowed only to close out the branch, before it is deleted. Merges to other people's branches or to release branches are not allowed.
- More than one pull request per story. The site's example is a pull request for a refactoring, then one for the new functionality, then another refactoring, each merged into trunk.
DORA names a heavy code review process as a common obstacle: when review takes hours or days, developers batch up many changes. Its answer is synchronous review. When the developer is ready to commit, somebody else on the team reviews the code right then.
CI on every merge
The trunk-based development site calls for a build server that verifies commits at two moments: when a short-lived branch is ready to be merged, and after the commit lands in trunk. The second run is needed because the first leaves room for error based on timing.
DORA's rule for a failed CI process: developers stop what they are doing and fix the problem immediately, or revert the change if it cannot be fixed in a few minutes.
Feature flags for unfinished work
Work that is not ready can still land in trunk. The site describes landing it behind a flag that is off in the release, so the commit goes into trunk as normal and stays inert in production. It also warns that flags get forgotten, and suggests a review-for-delete date for each one.
For a change that takes longer to complete, in code that many developers depend on, the site describes branch by abstraction:
- Introduce an abstraction around the code that will be replaced.
- Write a second implementation of the abstraction, turned off in trunk.
- Flip the switch to on for the rest of the team.
- Remove the old implementation.
- Remove the abstraction.
No commit pushed to the shared repository may jeopardize the ability to go live.
Release branches cut from trunk
DORA says release branches are not required when releases happen multiple times a day, because changes are deployed from trunk. The trunk-based development site says such teams solve a bad release by rolling forward: the fix goes into trunk, and the release to production is from trunk.
For a team that releases less frequently, monthly in its example, the site describes a release branch cut from trunk a few days before the release. Its rules:
- The release branch does not receive continued development work.
- A bug is reproduced and fixed on trunk, then cherry-picked to the release branch. A fix made on the release branch first can be forgotten, and that means a regression in a later release.
- The CI pipeline that guards trunk is duplicated to guard active release branches.
- Release branches are not merged back into trunk. Once release activity on them has stopped, they are deleted after some time. In Git, create a tag from the released commit before deleting the branch.
The two sources disagree on the last rule. DORA's page describes changes made in release branches as merged back to trunk as soon as possible, with bug fixes cherry-picked into releases in some cases.
Git's documentation notes that git cherry-pick -x appends a line naming the original commit, which can be useful when backporting a fix to a maintenance branch.
What has to be in place first
DORA lists these practices for a team that adopts trunk-based development:
- Small batches. Developers have to understand how to break their work up into small batches.
- Automated tests. A comprehensive and meaningful suite of automated unit tests, run before every commit.
- A fast build. Building and testing should take a few minutes.
Signs of progress
DORA lists four things to measure, each with a goal.
- Active branches on the application's code repository: three or fewer.
- Code freeze periods: none.
- Frequency of merging branches and forks to trunk: at least once per day.
- Time taken to approve code changes, where review is asynchronous: look hardest at the requests whose approval takes far longer than the average.
Sources
Want a second pair of eyes on yours? We do this work for a living.
More guides

Feature flags: release without a deploy
CI/CD · 4 min read
The kinds of flag, where to evaluate them, safe defaults and how to remove them.

DORA metrics: what they measure and how to collect them
CI/CD · 4 min read
The current five metrics, where the data comes from, and the ways teams misuse them.

Azure Pipelines templates: reuse stages across projects
CI/CD · 3 min read
Write a stage once, pass it typed parameters, and require pipelines to extend an approved template.