Branching strategies: Git-flow vs. trunk-based development

Choose the right platform and best branching strategy in an unbiased way.

Git-flow vs. trunk-based development

With Git platforms offered on the cloud, it is now easier than ever to create code repositories on a platform that you prefer.

Most popular platforms like Bitbucket, GitLab, GitHub, Azure DevOps, offer a free tier that is suitable to host open-source projects. Enterprise tiers are available for dedicated space for controlling employee and vendor access or advanced automation and reporting.

There are several popular branching strategies that you can adopt, the most popular are git-flow (a.k.a. long-lived feature branches) and trunk-based development.

Below, we compare git-flow vs. trunk-based noting key considerations for each.

Philosophy

Git-flowTrunk-based
As far as possible from main branchAs close as possible to main branch
New features are being started from develop branchShort-lived feature branches are started from main branch
New release branch is derived from develop branch; after it’s stabilized, release branch is deployedMain branch is always in a state ready to be deployed to production
Only hotfixes are derived from main branchHotfixes start from main or release branch; need to be cherry-picked back to main

Team composition

Git-flowTrunk-based
Lack of seniority within the teamWell-composed and experienced team
Working with other vendors/third party
Team augmentation model

Product type

Git-flowTrunk-based
Complex, mature, monolithic productMicroservices
Brown-field productShort-lived feature branches are started from main branch
Modern single page application (SPA) / Mobile apps
Proof-of-concept (POC) / Prototype
Distributed system components

Authoring process

Git-flowTrunk-based
GovernedTeam-driven

Deployment

Git-flowTrunk-based
Various deployment models can be usedContinuous Deployment practices are recommended:
Feature toggles
Quality gates
Canary testing
Self-service automation (eg. ChatOps)
Monitoring

Release frequency

Git-flowTrunk-based
Slower release cadence, pre-determined scheduleTeams are able to iterate quickly and independently

Never miss a beat.

Sign up for our email newsletter.