Building great software isn’t just about writing code but about how you work together as a team. You're not alone if you’ve ever felt bogged down by merge conflicts, long-lived branches, or endless delays in your release schedule.
We’ve been there too. At Axify, our development teams tried many software development strategies, but something was always missing.
That’s when we changed to trunk-based development. The results were fewer integration issues, faster feedback, and a workflow that actually keeps up with the pace of innovation.
This branching strategy changed how we handled frequent integrations and made our trunk branch the ultimate source of stability and speed. Now, we want to share exactly how you can adopt this method and improve your deployment frequency without breaking a sweat.
Let's get started!
What Is Trunk-Based Development?
Trunk-based development (TBD) is a version control strategy where you and your team commit small, frequent updates to a single branch, known as the “trunk.”
This approach helps you avoid the complexity of managing long-lived feature branches or separate branches for every task. Instead, your team works collaboratively on short-lived feature branches and quickly integrates code back into the trunk – often several times a day.
“Hey Caren, you forgot to add a semicolon in that file. You know the one you added in the middle of your commit chain.”
And this is where you start checking-out and rebasing and possibly end up in a merge conflict hell. (Richard Lenkovits)
Trunk-based development simplifies your development process through frequent merges. This strategy reduces merge conflicts, improves code quality, and ensures your codebase is always in a deployable state.
This is why TBD is a key practice for achieving continuous integration and continuous delivery (CI/CD). Your production environment becomes more stable, and your team can easily adapt to changes, delivering value faster.
Pro tip: If you're serious about aligning your software efforts with broader business goals, Axify’s OKR tracker can help. It connects your team’s progress to measurable outcomes, which can help you improve both performance and focus.
Trunk-Based Development Alternatives
Alternatives such as GitFlow and feature-based development take different approaches than TBD. They typically involve more branching complexity and longer integration times. Here’s how they compare to TBD.
GitFlow vs. Trunk-Based Development
GitFlow is a stricter version control strategy that relies on multiple branches to manage development, such as feature, release, and hotfix branches. Trunk-based development, in contrast, is a more open and collaborative model. All developers work with a single branch (the trunk) and merge changes multiple times a day.
GitFlow slows down the development process because its branching model creates complexity. Long-lived branches delay feedback and increase the chances of merge conflicts.
Side note: Dave Farley, an important voice in continuous delivery, even suggests that GitFlow contradicts CI/CD principles. He explains that merging infrequently and managing several release branches goes against the goal of continuous integration – providing fast feedback and always maintaining a production-ready codebase. Here’s his entire review:
In trunk-based development, the simplicity of working with fewer branches allows you to move faster, integrate more often, and reduce the risk of larger commits breaking your code to production. TBD is the better fit if you’re aiming for faster releases and cleaner integration processes.
Feature-Based Development vs. Trunk-Based Development
Feature-based development involves creating separate branches for individual features or tasks. These branches can live for days, weeks, or even months before merging into the main branch. In contrast, trunk-based development keeps branches short-lived (sometimes just hours) to focus on smaller, frequent merges into the trunk.
The issue with feature-based development lies in its tendency to encourage “merge hell.”
Long-lived feature branches diverge significantly from the trunk and make integration complicated. This approach promotes larger commits, which can hide bugs and slow down feedback loops.
“Feature-based development promotes merging hell and bigger batch work, while trunk-based development focuses on smaller batches and faster flow.”Alexandre Walsh
Axify's Co-Founder and Head of Product
With TBD, frequent merges provide earlier feedback and help you spot integration issues quickly. Using feature flags allows you to merge incomplete features into the trunk without exposing them to end users. This way, your production environment stays stable, and your development teams stay agile.
Trunk-Based Development: Pros and Cons
Trunk-based development has become a key practice for high-performing software teams. While TBD offers many benefits, it also comes with its own set of challenges. Let’s explore both sides to help you decide if it’s the right fit for your team.
Why Use Trunk-Based Development?
As we already explained, TBD simplifies your development process by focusing on small, frequent changes. Here’s how this approach impacts your work:
- Small changes, big impact: Smaller, frequent changes are easier to understand, review, and integrate. This minimizes your risks and makes it less likely that large conflicts disrupt your workflow.
- Easier to test: Frequent integrations ensure you’re constantly testing smaller pieces of code. This keeps your codebase stable and helps catch bugs early.
- Higher quality code: Integrating frequently allows your team to adopt better testing and validation practices. This leads to fewer bugs and better overall quality.
- Bugs are easier to spot: Small changes make debugging simpler. When something breaks, you’ll know exactly what changed and can resolve issues faster.
- Faster incident resolution: TBD supports quicker recovery from production incidents. Frequent commits mean fewer changes to sift through when identifying and fixing problems.
- More responsive to customers: Agility is critical. With TBD, you can deploy updates faster and respond to customer needs or market changes in real time.
Pro tip: Axify’s Value Stream Mapping helps your CI/CD implementation by identifying bottlenecks and streamlining your team’s workflows. You can track metrics such as task age, collaboration levels, and delivery frequency to improve your development process.
Challenges of Trunk-Based Development
While TBD offers many advantages, it also demands a disciplined approach and robust infrastructure.
1. Heavy Reliance on Test Automation
Without automated tests, TBD can lead to chaos. Every integration must be tested thoroughly to maintain a stable trunk.
If your team doesn’t have automated testing in place, you risk significant failures. This is not optional because you need a comprehensive testing suite to make TBD work effectively.
2. Requires Discipline from Developers
Your team must commit small, incremental changes frequently. This approach forces everyone to break their work into smaller tasks. It’s a big shift from feature-based workflows where larger, isolated changes are the norm.
3. High Dependency on CI/CD
TBD thrives on a solid CI/CD pipeline. If your pipeline is slow or unreliable, you’ll experience delays and frustration. Automating builds and tests is critical to success.
4. Steep Learning Curve
Adjusting to TBD can take time if your team is used to feature branching. Developers need training and coaching to learn how to work in small batches and integrate changes frequently.
Trunk-Based Development Branching Strategy
A successful trunk-based development strategy relies on a few core practices that simplify your workflow and improve collaboration. Adopting these strategies helps you keep your team aligned, reduce bottlenecks, and ensure faster delivery of high-quality software.
Small Batches
It is important to break your work into small batches. When you commit smaller changes, you minimize the chance of introducing errors or conflicts. You can also review, test, and merge changes more quickly. Small batches ensure your code remains manageable and keep your trunk stable.
Feature Flags
Feature flags let you integrate incomplete work without affecting the live product. Toggling features on or off allows you to test new functionality safely in production environments. For teams that cannot deploy directly to production—for example, those working on mobile apps, hard clients, or on-premises deployments—using production-like environments is the next best alternative. This approach provides flexibility and reduces risks when deploying unfinished features.
Automated Testing
You need automated testing to maintain confidence in your trunk’s stability. Automated tests catch errors early, so your changes don’t disrupt the rest of the codebase. Make sure every commit runs through a comprehensive testing pipeline before merging. This keeps your workflow smooth and your product reliable.
Asynchronous Code Reviews
Asynchronous code reviews save time while maintaining quality. Developers submit and review code independently without blocking other processes or team workflows. This approach maximizes system resource utilization and improves efficiency.
Don’t Keep Too Many Branches
Having too many branches can overwhelm your team and lead to longer merge times. So, make sure to limit active branches to a small number – ideally fewer than three. Fewer branches mean fewer conflicts, faster merges, and more streamlined collaboration.
Daily Merges
Merging your work daily reduces integration headaches. Frequent merges keep the trunk up to date and minimize the risk of conflicts. When you merge daily, you maintain a steady flow of progress and avoid surprises during larger integrations.
Constant Workflow
Consistency is key to success with trunk-based development. Encourage your team to follow the same practices every day. This ensures predictable workflows, fewer delays, and faster feedback on your changes. A constant workflow keeps your team aligned and productive.
Pro tip: The Daily Digest feature in Axify gives you a clear view of your tasks, their progress, and any bottlenecks. You can prioritize items based on their age or importance and improve team collaboration at a glance. It’s a simple way to stay on top of your workflow.
Make Trunk Stability the Team’s Top Priority
The stability of the trunk must be the number one priority for the entire team.
“If the trunk is in an undeployable state, it should be fixed immediately, even if it requires the entire team to swarm on the issue. Think of it as pulling the "Andon cord" in the Toyota Production System—an immediate action to stop and resolve problems in the workflow.”
- Pierre Gilbert, Software Delivery Expert at Axify
The same principle applies to system degradation or downtime: immediate action is critical to restore stability and maintain team momentum.
Streamline QA with CI/CD
Many teams are bogged down by cumbersome quality control (QC) bureaucracies, such as change advisory boards (CAB), MEPS documents, or other manual processes. However, adopting a solid CI/CD pipeline with proper automation, tooling, and processes can provide better traceability and quality assurance (QA) than any handwritten documentation passed hand-to-hand. CI/CD ensures that quality gates are automated, efficient, and effective. This means faster, more reliable deployments with less manual overhead.
Trunk-Based Development Example
To truly understand the power of TBD, it helps to see it in action. Let’s see a real-world scenario where a small team of developers uses this model to roll out a new feature for an e-commerce website. You’ll see how trunk-based development helps you maintain a smooth, efficient workflow by breaking the process into simple steps.
Context: Developing a Discount Feature
Imagine you’re part of a team of five developers tasked with adding a discount code feature to the checkout page of an e-commerce website. Every change you make uses trunk-based development to integrate directly into the main branch (trunk) through small, incremental commits. This approach ensures your codebase remains clean, stable, and ready for deployment.
Step 1: Small, Incremental Changes
Instead of working on a large feature branch, the team splits the work into smaller tasks committed directly to the trunk. For example:
- Commit 1: Add a database schema for storing discount codes.
- Commit 2: Build an API endpoint for validating discount codes.
- Commit 3: Implement a text box on the front end for entering discount codes.
- Commit 4: Write automated tests for discount validation.
Each commit represents a standalone, minor change contributing to the overall feature.
You can also use the S.P.I.D.R. framework for story splitting to break down work effectively. The point is that each story remains small and independent and delivers value. That way, it’s easier to manage and integrate into the trunk.
Step 2: Continuous Integration
Every commit triggers the CI pipeline, running automated tests to ensure compatibility with the current trunk. If an issue arises (e.g., a test fails or a conflict appears), it's addressed immediately, keeping the trunk in a deployable state.
Step 3: Feature Toggling for Unfinished Work
To prevent unfinished functionality from being exposed to users, the team uses feature toggles:
- The text box for discount codes is hidden behind a toggle.
- The API endpoint remains inactive until the toggle is switched on.
This allows developers to commit and deploy incomplete features without impacting the user experience.
“Decoupling deployment from release is key. Code that can go to production without breaking the system is production-ready and should be deployed immediately. Feature complete, on the other hand, means delivering real value to the end user. Waiting for feature completeness before deployment often delays progress unnecessarily.”
- Pierre Gilbert, Software Delivery Expert at Axify
Step 4: Frequent Deployment, Delayed Release
With TBD, deployments happen frequently, even if the feature isn’t ready for release. For example:
- The database schema and API endpoint are deployed to production as soon as they're committed, but they remain inactive.
- The frontend text box has been added but is hidden from users.
This approach ensures changes are integrated and tested in the live environment without being released prematurely.
Step 5: Finalizing the Feature
Once all changes are committed, the team enables the feature toggle in a controlled release. After verifying everything in a staging environment, the toggle is switched on for all users. The feature is live and deployed incrementally, with no merge conflicts or downtime.
Why This Works So Well
Trunk-based development keeps your workflow fast and predictable. Each commit is a small step forward, and feature flags let you separate deployment from release. You can safely push changes to production while holding off on releasing them to users until they’re ready.
Pro tip: The Axify’s Daily Digest mentioned above also helps you see aging tasks and unblock work.
Metrics to Follow
Tracking the right metrics helps you understand and improve your development process. Axify lets you focus on key metrics that directly impact your team’s efficiency and performance. Here are the ones you should pay attention to:
1. Lead Time for Changes
Lead time for changes measures how long it takes for a code change to occur in the production environment. Breaking this down into sub-phases gives you actionable insights:
- Coding time: How long it takes to write the code.
- Pick-up time: The delay between completing the code and someone starting the review.
- Review time: The time spent on code reviews.
- Deployment time: How quickly the changes are pushed into production.
Analyzing these stages helps you identify bottlenecks and make adjustments to speed up your workflow. According to Google’s State of DevOps, elite teams deploy code on demand multiple times per day, while low performers take up to six months. This huge difference shows how smaller tasks and fixing delays can speed up your workflow.
2. Deployment Frequency
How often do you deploy changes? Frequent deployments are a hallmark of efficient teams using trunk-based development. This metric reflects the size of your batch work – smaller batches mean fewer errors and faster feedback.
Elite teams have 182X more deployments per year and 2293X faster deployment recovery times. This shows how smaller batches and frequent feedback make trunk-based development more efficient.
3. Pull Request Cycle Time
Pull request cycle time shows how long it takes to open and merge a pull request. Axify breaks this down to highlight delays in reviews or approvals to help you prioritize and streamline these processes.
Start Implementing Trunk-Based Development with Axify
If you’re ready to improve your team’s delivery speed and reduce bottlenecks, now’s the perfect time to adopt trunk-based development. With Axify, you gain tools that simplify every step – from tracking deployment frequency to identifying delays in code reviews. You’ll streamline your process, spot issues early, and deliver value to your users faster.
Axify can help you align your development practices with your business goals. By combining insights into workflows, collaboration, and performance, Axify equips you with metrics so you can make data-driven decisions with confidence.
Take the first step towards transforming how your team works. Book a demo with Axify today and see how you can simplify your workflows and achieve better results faster. Let us help you build software that makes an impact.