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.
|As far as possible from main branch||As close as possible to main branch|
|New features are being started from develop branch||Short-lived feature branches are started from main branch|
|New release branch is derived from develop branch; after it’s stabilized, release branch is deployed||Main branch is always in a state ready to be deployed to production|
|Only hotfixes are derived from main branch||Hotfixes start from main or release branch; need to be cherry-picked back to main|
|Lack of seniority within the team||Well-composed and experienced team|
|Working with other vendors/third party|
|Team augmentation model|
|Complex, mature, monolithic product||Microservices|
|Brown-field product||Short-lived feature branches are started from main branch|
|Modern single page application (SPA) / Mobile apps|
|Proof-of-concept (POC) / Prototype|
|Distributed system components|
|Various deployment models can be used||Continuous Deployment practices are recommended:|
|Self-service automation (eg. ChatOps)|
|Slower release cadence, pre-determined schedule||Teams are able to iterate quickly and independently|