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

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

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, and Azure DevOps offer a free tier 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, two of the most popular being 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 started from develop branchShort-lived feature branches started from main branch
New release branch derived from develop branch, after stabilized release branch deployedMain branch always in a state ready to be deployed to production
Only hotfixes 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-partyTeam augmentation model

Product type

Git-flowTrunk-based
Complex, mature, monolithic productMicroservices
Brown-field productModern 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 usedContinuous Deployment practices recommended, such as feature toggles, quality gates, canary testing, self-service automation (e.g.. ChatOps), and monitoring

Release frequency

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

Automation workflow

Automation workflow

Book a workshop