glossary

Trunk-Based Development

A version control branching model where developers integrate small, frequent changes directly into a single shared main branch (trunk), with short-lived feature branches and minimal branching complexity.

Trunk-based development (TBD) is a branching strategy that prioritises continuous integration over branch isolation. Developers work on short-lived feature branches (typically lasting less than a day) or commit directly to the main branch (the trunk). The core principle is that no branch should live long enough to diverge significantly from the trunk, keeping merge conflicts small and rare. The model is strongly associated with continuous integration and continuous delivery (CI/CD). Teams practicing TBD typically integrate their changes to the trunk multiple times per day, with automated builds and tests running on each integration. This catches integration issues early, when they are cheapest to fix. The recommended practice is to keep unpushed work under 2 hours of development time. TBD contrasts with Git Flow, where feature branches can live for weeks and integration happens in batches. Research (by DORA/Accelerate) shows that TBD practices correlate with higher delivery performance — lower lead times, higher deployment frequency, and lower change failure rates. The key requirement is strong CI/CD automation and a culture of small, incremental changes.

# Commit directly to main after a short local test
git commit -m 'fix(button): correct hover state color contrast'
# Short-lived feature branch, merged within hours
git checkout -b fix/input-validation
git commit -m 'fix(form): add email format validation on blur'
git checkout main && git merge fix/input-validation
git push

git-agent is an ideal companion for trunk-based development. Its ability to quickly create atomic commits with meaningful messages encourages the small, frequent commits that TBD requires. The automated commit splitting also reduces the friction of preparing clean history for direct-to-main integration.

brew install gitagenthq/brew/git-agent
Does trunk-based development mean I cannot use feature branches?
No, short-lived feature branches are part of TBD. The key is that branches should be short (hours, not days or weeks) and integrate frequently. Even a few hours of work on a branch is fine as long as you merge back to trunk the same day.
How does trunk-based development work with code review?
Code review works the same — through pull requests on short-lived branches. The difference is that the branches are smaller and more frequent, making reviews easier because each PR contains fewer changes. Reviewers can give feedback on a 50-line PR much faster than a 500-line one.
Is trunk-based development suitable for all projects?
TBD works best for teams with strong CI/CD automation, comprehensive test coverage, and a culture of incremental development. Projects with regulatory requirements, formal release gates, or large distributed teams may benefit from the more structured Git Flow approach.