Trunk-based development: process, examples, strategy, implementation
Blog post from Unleash
Trunk-Based Development (TBD) is a software development strategy that encourages developers to commit code changes to a single shared branch, known as the "trunk," to reduce merge conflicts and accelerate development through small, frequent commits. Unlike feature-based development, which uses long-lived feature branches, TBD uses short-lived branches to minimize integration challenges, supported by practices like continuous integration (CI), feature flags, and regular releases to maintain a deployable mainline. TBD's emphasis on frequent code integration aligns closely with the principles of continuous integration and continuous delivery (CI/CD), facilitating faster feedback loops and streamlined release processes. It is distinguished from Gitflow, which employs a more complex branching model, by promoting a consistent, stable main branch through the use of feature flags, allowing incomplete features to be merged without affecting end-users. Both small and large teams can implement TBD by leveraging robust CI/CD pipelines, automated testing, and strategic use of feature flags to manage feature rollouts and mitigate integration issues. The adoption of TBD can lead to improved collaboration, reduced code divergence, and more efficient software delivery, as demonstrated by case studies like those of Wayfair and Tink. Implementing TBD requires a strategic shift in version control practices, emphasizing continuous integration and testing, supported by feature flags to manage the release of new capabilities and maintain trunk stability.