kloia Blog

What is Trunk Based Development? - kloia Blog

Written by Mehmet Ali Aydın | Apr 22, 2019 7:59:40 PM

Trunk-based Development is a source-control branching model where there is only a single branch called ‘trunk’ in VCS. Developers collaborate on the ‘trunk’ branch and no long-living development branches. Trunk-based Development model focuses on continuous integration so long-living development branches, which also cause a ‘merge hell’, are avoided.

 

While developers collaborate on the ‘trunk’ branch, they may have short-living branches that live up to 1 day. Branch lifetime has a strong correlation with Agile Methodology adoption and Agile Stories. Small stories make it easier to keep branch lifetimes shorter.

 

Trunk-based Development is a continuous integration friendly branching model and allows teams to detect problems early, especially compared to other VCS branching models with long-living branches.

 

Figure 1. Team 1’s branch network, Team 1 follows trunk-based development (left) and Team 2’s branch network, Team 2 has long-living branches (right).

 

As seen in Figure 1., Team 1 has the chance to detect integration problems at t4, t7, t10, t11 and t13 while Team 2 can only detect the integration problem on t13 which is way later than Team 1.

We strongly recommend trunk-based development and following a branching model which doesn’t require long-living branches, such as using feature toggles and branch by abstraction.