Trunk-Based Development
Trunk-based development is a source-control branching strategy in which developers integrate small, frequent changes directly into a single shared branch (the trunk, often called main), avoiding long-lived feature branches in favor of…
Definition
Trunk-based development is a source-control branching strategy in which developers integrate small, frequent changes directly into a single shared branch (the trunk, often called main), avoiding long-lived feature branches in favor of continuous integration.
Overview
Trunk-based development (TBD) is a version-control workflow in which most or all development happens against a single shared branch — the 'trunk' (commonly `main` or `master`) — rather than isolating work on long-lived feature branches that are merged back only when complete. Developers commit small, frequent changes directly to trunk (or through very short-lived branches lasting hours, not days or weeks, that are merged quickly), and incomplete or in-progress features that shouldn't yet be visible to users are hidden behind feature flags rather than being kept isolated on a separate branch. The practice is a foundational prerequisite for continuous integration and continuous delivery (CI/CD): because trunk is always the single source of truth and is kept in a near-always-releasable state, automated build and test pipelines can run against every small commit, catching integration problems immediately rather than during a large, painful merge at the end of a long-lived branch's life. This directly addresses 'merge hell' — the exponentially growing difficulty of reconciling two long-diverged branches — since changes are integrated continuously in small increments rather than accumulated and reconciled all at once. Trunk-based development is closely associated with elite engineering-performance research, notably Google's internal practices and the DevOps Research and Assessment (DORA) team's State of DevOps reports, which have repeatedly found trunk-based development (short-lived branches, frequent small merges) correlated with higher-performing software delivery teams, measured by deployment frequency, lead time for changes, and change failure rate. It contrasts with Git Flow and other long-lived-branch models (feature branches, release branches, develop branches) that were popular in earlier eras of software development but require more manual merge coordination and tend to delay integration until larger batches of work are 'complete.' Successful trunk-based development typically depends on a mature testing and CI culture (a strong automated test suite gating every commit), feature flags to decouple deployment from release, and small, incremental commit habits, since without these supports, committing directly to trunk can destabilize the shared branch for everyone.
Key Concepts
- All (or nearly all) development integrates into a single shared trunk branch
- Feature branches, if used at all, are extremely short-lived (hours, not weeks)
- Incomplete features are hidden via feature flags rather than isolated on separate branches
- Foundational prerequisite for continuous integration and continuous delivery (CI/CD)
- Avoids 'merge hell' by integrating small changes continuously instead of in large batches
- Correlated with elite software delivery performance in DORA's State of DevOps research
- Requires a strong automated test suite to keep trunk in a near-always-releasable state
- Contrasts with long-lived-branch models like Git Flow
Use Cases
Frequently Asked Questions
From the Blog
Trunk-based development vs Git Flow: choosing a branching model
Choose a branching model from your release process rather than your preferences. Long-lived branches exist to hold work back from a release, so if you ship continuously they only accumulate merge debt — and trunk-based development is a bet on automated tests and feature flags.
Read More ProgrammingPython Decorators: A Practical Guide for Beginners
Decorators are one of Python's most powerful features — they let you wrap functions with reusable logic without modifying the original. This guide explains how they work from first principles, builds several practical decorators (timing, caching, authentication), and covers class-based decorators and decorator factories.
Read More ProgrammingWhat Does a React Developer Actually Do?
A React developer builds and maintains user interfaces using the React JavaScript library, turning designs into interactive, component-based web applications. This guide covers the daily responsibilities, core skills, and typical career path for the role.
Read More AI & TechnologyBiometrics Explained: How Body-Based Authentication Works
Biometrics are measurements of physical or behavioral traits, such as fingerprints or facial structure, used to verify identity. This guide explains how biometric systems work, common types, and the security and privacy trade-offs involved.
Read More