Trunk-Based
Trunk-Based Development
Trunk-Based Development is a version control strategy where developers merge small, frequent updates to a single branch, typically called the "trunk" (or main). It is a key practice for Continuous Integration and Continuous Deployment (CI/CD).
Core Principles
Single Source of Truth
Everyone works on the same branch. Long-lived feature branches are avoided to prevent "merge hell" and ensure that the codebase is always in a deployable state.
Frequent Commits
Developers push their changes multiple times a day. This ensures that the code is constantly integrated, and any conflicts are small and easy to resolve.
Visualizing the Flow
In Trunk-Based Development, the "trunk" is a straight line, with very short-lived branches that are created and merged back within hours or a day.
Automated Testing
To maintain the stability of the trunk, robust automated testing (unit, integration, and end-to-end) is essential. Every commit is verified before and after being merged.
Feature Flags
When large features take more than a day to complete, they are hidden behind Feature Flags (or toggles). This allows the code to be merged into the trunk without exposing the unfinished feature to users.
Visual Flow

Trunk-Based Development is preferred by high-performing teams for its ability to reduce lead times and increase deployment frequency.