Trunk Based Development

What Is
Trunk-Based Development?

Trunk based development is a software development strategy where engineers merge smaller changes into the main codebase. One benefit of this is that it helps avoid any major issues when releasing a software product.

The strategy shifts the focus away from long-lived feature branch development and onto smaller changes, merging single branches into the main codebase. One of the many benefits of this strategy is that it prevents major releases of a software product from having bugs and minimizes merge hell with new code.

increase collaboration

Improve Your Devops Collaboration Process

Engineering teams need to be on the same page with code revisions. Source-control systems are a better way for engineers to work together without overwriting each other's changes. The master branch of the code is the main source of development on which other development branches grow. The process of combining revisions makes it easy for developers to quickly identify the most recent version of the code. 

Trunk-based development is collaborative and utilizes short-lived branches for code reviews to ensure high quality and collaboration with development teams. The focus is on building software and integrating practices like feature branches and code reviews. The goal is to create a framework for working together and maintaining a high level of quality and collaboration. 

minimize merge conflicts

What Are The Benefits?

The main benefits of trunk-based development are that it allows for continuous integration, consistent code review, and smooth code releases. 

Trunk-based development is an important practice for continuous integration. If you want the benefits of CI, your team needs to make sure to make thier builds and tests automated. But if developers work on long, infrequent new branches that are not often integrated into a shared branch, then CI isn't living up to its full potential. 

With trunk-based development, developers are able to easily integrate their code with the main branch. When they finish new work, they merge the changes into the main branch. However, they should not merge to the main branch until they have completed a successful build. 

If you've made changes to your code and another developer has made changes to the same part of it, it can cause a merge conflict. Particularly as teams grow and as the code base scales, these bumps become more difficult to manage. That's because developers will often create separate branches that deviate from the source branch and other developers may be merging code on those branches. Luckily, a trunk-based development process minimizes the number of merge conflicts an engineering team experiences.

Devcycle feature flags

Get Started For Free

Reduce cycle time, release complexity, and deployment stress

Yellow Bullet

No salespeople

Yellow Bullet

No credit card required

Yellow Bullet

Cancel anytime

Implementation

Trunk Based Development With Feature Flags

Developers can use feature flags to get feedback on new features before they're launched. As part of the process, developers make code changes in their own branch but don't work it into the main branch yet. After getting feedback and verifying that the new functionality works, the developer can add it to the main branch. 

New features and small changes to the code can be made gradually and safely with feature flags. For instance, companies can use this tool to introduce new features slowly, giving themselves ample time for testing before showing it to end-users.

Learn more about

Transitioning To Trunk Based Development

We dive into when you can use trunk-based development, why you should use it, development alternatives, and how you can easily implement this strategy with the help of feature flags.

Common Questions

How Does It Differ From Gitflow?

Gitflow is a versioning system that comes from a different development model. It has more branches and larger commits than traditional Git. Every developer gets their own branch, and they only merge it to the main trunk branch when they're done. This means that there are more branches, but also larger commits. When you use long-lived branches, it requires more work to merge them back into the trunk. When changes are made to this branch, it's more likely that they will conflict with the changes in the main branch. 

Designing a Gitflow system can be a complex process. There are many branches to manage and potentially merge together. One of the main benefits of Gitflow is that it can give you a safety net in case something goes wrong with development, hotfixes, features, or releases. Since there is more complexity than with other systems, extra planning sessions and team feedback are needed for making new changes. 

Trunk-based development is much simpler than using Gitflow. If you're using trunk-based development, the main branch is assumed to always be stable and ready to deploy. Meanwhile, the traditional method is more complicated because it focuses on fixing one branch while trying to maintain other branches simultaneously. Trunk-based development is easier since it focuses on the main branch as the source of fixes and releases.

Get Started Today

Create A Free Account With DevCycle

DevCycle is a feature management tool that allows you and your team members to leverage feature flags to ship faster, reduce risk and maximize the impact of your releases. By leveraging feature flags as a best practice, you can increase your release cadence by minimizing release complexity. 

Through continuously deploying and testing in production, you can organize your feature flags in several environments with our APIs without needing to leave your workflow. Developers, product, and marketing teams can toggle a feature on or off in the DevCycle dashboard to control who has access.  

Your team can also predetermine a rollout schedule to specify which users have access to a new feature and at what date. This means you can create a predetermined rollout period and let DevCycle gradually deploy it based on the rollout schedule your team set up. 

DevCycle also enables you to maximize the impact of your feature flags through zero latency experimentation build for developers. Iterate and optimize features with the ability to dynamically modify content in production without redeployments.  

Engineering teams can employ continuous integration and continuous delivery to keep up with the competition. This practice will allow for faster development cycles, as well as the ability to deploy new features without risk of errors. Practices like trunk-based deployment can also help mitigate risk. 

Want to use feature flags to start integrating trunk-based development to improve your software development workflow? Get started with a free trial of DevCycle.

Building in public

Hear Directly From Our Team

DevCycle started from us wanting to build something we want to use for ourselves. We're documenting every major decision and technology we're choosing to use.

Learn More About What We're Building
Building In Public Image