WBISCT Pty Ltd – Enterprise Architecture Consulting and Training

Why I Prefer Trunk-Based Development Over Feature Branching and GitFlow

Have you ever taken a look at a development workflow and thought, “There must be a better way to do this”? I know I have.

We’re not the only ones. Companies such as Facebook and Google have been successfully adopting Trunk-Based Development in their projects as well. How can you take advantage of Trunk-Based Development, and how can you implement it? Read on to find out.

Feature Branch Development (a.k.a., GitFlow)

Before we start detailing the rules of Trunk-Based Development, let’s take a look at its counterpart: Feature Branch Development, also known as the GitFlow model.

The classical approach to the development of a product is to create a new branch for every feature we take care of and maintain this branch until we can merge it with the mainline.

In the meantime, we must check out to a hotfix branch, resolve merge conflicts, remember about our branches, etc.

The Feature Branch Development workflow is illustrated below.

   

What you see above is an example flow of just one developer’s work. Could you image how many branches we would have if our company grew to 100 developers? And what would happen if the number of teams grew to 100? There would probably be continuous merging development. And any merges often would end with conflicts.

In other words, you’d be facing merge hell.

No one likes a merge conflict. When it occurs, one needs to focus both on his/her part of the code as well as the code of another developer.

READ the full article