Trunk-based development is software development strategy where engineers merge smaller changes more frequently into the main codebase and work off the trunk copy rather than work on long-lived feature branches.
With many engineers working in the same code-base, it's important to have a strategy for how individuals work together. To avoid overriding each other's changes, engineers create their own copy of the codebase, called branches. Following an analogy of a tree, the master copy is sometimes called the mainline or the trunk. The process of incorporating the changes of an individual's copy into the main master trunk is called merging.
To understand how trunk-based development, it's useful to first look at the alternative strategy, feature branch development.
In feature branch development, individual software developers or teams of engineers do not merge their new branch until a feature is complete, sometimes working for weeks or months at a time on a separate copy.
This long stretch of time can make the process of merging difficult because the trunk or master has likely changed due to other engineers merging their code changes. This can result in a lengthy code review process where the changes in different pull requests are analyzed to resolved merge conflicts.
Trunk-based development takes a more continuous delivery approach to software development, and branches are short-lived and merged as frequently as possible. The branches are smaller because they often contain only a part of a feature. These short-lived branches make the process of merging easier because there is less time for divergence between the main trunk and the branch copies.
Thus, trunk-based development is a methodology for releasing new features and small changes quickly while helping to avoid length bug fixes and "merge hell". It is a growing popular devops practice among agile development teams, and is often paired with feature flags to ensure that any new features can be rolled back quickly and easily if any bugs are discovered.
Be inspired by 40+ experiment ideas that have generated millions in revenue.
Learn the benefits of experimenting at scale from this original research report from the Harvard Business Review
This assessment is the starting point to understanding your organization’s capabilities and will set you on the path to building a high-performing program.
An error has occurred
You can get the very best of Optimizely without spending a dime.Try it out for 30 days, on us.
Hang tight! We're creating your account and password instructions are headed to your inbox.
Please correct form errors
Get a free account with full access to Optimizely's APIs and SDKs.
Already have an Optimizely account? Sign in here.