glossaryTrunk-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.
explanation
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.
examples
# Commit directly to main after a short local testgit commit -m 'fix(button): correct hover state color contrast'# Short-lived feature branch, merged within hoursgit checkout -b fix/input-validationgit commit -m 'fix(form): add email format validation on blur'git checkout main && git merge fix/input-validationgit pushhow git-agent helps
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-agentFAQ
Does trunk-based development mean I cannot use feature branches?How does trunk-based development work with code review?Is trunk-based development suitable for all projects?