Trunk-Based Development
Trunk-based development is a source-control practice in which a team integrates small changes into one shared main branch. It limits long-lived branches so conflicts and defects surface while each change is still easy to understand.
itDevOps and software delivery | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Trunk-Based Development
Trunk-based development is a way of arranging software work around one shared branch, usually called main. The point is not to admire the branch name as though it had won a small trophy. The point is to make each change join the current shared product state while it is still small enough to understand, test, and repair.
The old trouble is delayed integration. Two changes can look perfectly polite on their separate branches, then meet weeks later and discover that they disagree about reality. A small batch keeps that meeting short. The next change starts from the newly integrated trunk, so the team learns from the same result instead of maintaining several private versions of the product.
This does not require a heroic leap directly onto main. A small team may commit there after local checks. A team that needs review can use a short-lived branch, run checks, get review, merge promptly, and delete it. Waiting counts. A five-minute pipeline does not make a four-day review queue less of an integration delay; it merely gives the delay a helpful progress bar.
Large work also has an escape hatch that is less dramatic than keeping it away from everyone for a month. A feature flag can let code integrate while its user-facing behavior remains hidden. A branch by abstraction can let old and new implementations coexist behind an interface while callers move in steps. Both are temporary structures. They need tests, ownership, and removal, or the trunk becomes a museum of cautious decisions.
The surprising part is that a green trunk is not a certificate of perfection. It is usable evidence: the shared baseline passed the checks the team relies on. When it breaks, restore it before adding unrelated changes. When a release branch exists, use it to maintain a supported release, not as a second ordinary development line. One mainline is a coordination choice, not a ban on every other branch.
Read the Intro for the full model and the supporting techniques. Use Slides for the flow and decision points. Keep the Cheatsheet nearby when shaping a change, diagnosing a queue, or deciding whether a temporary control has earned its removal. Then take the exercise: it turns the idea into a small local Git history, which is considerably less alarming than discovering it during a large merge.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://trunkbaseddevelopment.com/
Supports
- Definition of one shared trunk and the direct-to-trunk and short-lived-branch styles
- Relationship to continuous integration, feature flags, branch by abstraction, and release branches
- Need for pre-integration and trunk verification
- https://dora.dev/capabilities/trunk-based-development/
Supports
- Observable characteristics of short branch lifetime, few active branches, frequent integration, and limited code freezes
- Small-batch development and measures of integration behavior
- https://dora.dev/capabilities/continuous-integration/
Supports
- At-least-daily mainline integration and small batches
- Automated unit tests, fast feedback, and immediate broken-build response
- Common failures involving manual builds, slow checks, and delayed repair
- https://dora.dev/capabilities/continuous-delivery/
Supports
- Trunk-based development as a continuous-delivery capability
- Relationship to test automation and deployment automation
- https://trunkbaseddevelopment.com/short-lived-feature-branches/
Supports
- Prompt merge and deletion of temporary branches
- Single-developer or pair ownership and integration direction toward trunk
- Direct-to-trunk as an alternative for small teams
- https://trunkbaseddevelopment.com/feature-flags/
Supports
- Feature flags as controls for integrating incomplete behavior
- Need to test meaningful flag combinations and remove temporary flags
- https://martinfowler.com/articles/feature-toggles.html
Supports
- Separation of code deployment from feature release
- Release-toggle use in trunk-based development
- Testing burden, carrying cost, ownership, and cleanup of feature flags
- https://trunkbaseddevelopment.com/branch-by-abstraction/
Supports
- Incremental replacement of longer-running changes through an abstraction
- Limits and cleanup considerations for the technique
- https://trunkbaseddevelopment.com/branch-for-release/
Supports
- Release branches cut from trunk for release maintenance
- Trunk-first fixes followed by selected application to release branches
- Separation of development and release lines
- https://github.com/sindresorhus/awesome
Supports
- Starting index used to discover topic-relevant curated lists
- https://github.com/wmariuss/awesome-devops
Supports
- Discovery of GitHub Actions, GitLab CI, Jenkins, Buildkite, and Unleash as relevant DevOps ecosystem tools
- https://github.com/ligurio/awesome-ci
Supports
- Discovery and comparison context for GitHub Actions, GitLab, Jenkins, and Buildkite
- https://docs.github.com/en/actions/get-started
Supports
- GitHub Actions learning path for workflows, continuous integration, and continuous deployment
- https://docs.gitlab.com/ci/pipelines/
Supports
- Branch, merge-request, merged-result, and merge-train pipeline behavior
- Jobs, stages, runners, and repository-based pipeline configuration
- https://www.jenkins.io/doc/book/pipeline/
Supports
- Pipeline as code in a source-controlled Jenkinsfile
- Pipeline execution for branches and pull requests
- https://buildkite.com/docs/pipelines/getting-started
Supports
- Repository-backed pipeline definitions, steps, builds, jobs, and agents
- https://docs.getunleash.io/concepts/feature-flags
Supports
- Activation strategies, variants, lifecycle states, and cleanup support for feature flags
- https://martinfowler.com/articles/originalContinuousIntegration.html
Supports
- Original 2000 Continuous Integration article and its daily integration and automated-build guidance
- https://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git.html
Supports
- Git's 2005 origin
- https://paulhammant.com/2015/04/23/the-origins-of-trunk-based-development/
Supports
- Historical examples of one-branch development and Microsoft SLM's daily shared-master workflow
- 2015 historical account of Trunk-Based Development origins
- https://trunkbaseddevelopment.com/branch-by-abstraction/
Supports
- 2007 naming of Branch by Abstraction and its historical purpose
- https://martinfowler.com/books/continuousDelivery.html
Supports
- 2010 Continuous Delivery publication and its relationship to Continuous Integration
- https://github.blog/news-insights/how-github-develops/
Supports
- 2011 public account of GitHub Flow
- https://phdo.paulhammant.com/Trunk-Correlated-Practices-Chart
Supports
- 2014 first version of the Trunk Correlated Practices chart
- https://trunkbaseddevelopment.com/book/
Supports
- 2017 transformation of the Trunk Based Development site into a book
- https://www.atlassian.com/blog/development/turning-ff-cleanup-into-handsoff-ai-workflow
Supports
- Practitioner account of stale feature-flag complexity and tracked cleanup work
- https://circleci.com/docs/guides/orchestrate/workflows/
Supports
- CircleCI workflow configuration and job orchestration
