Video in progress

Middle 🌿 Git

Compare Git Flow, GitHub Flow and trunk-based development. Which would you choose for a small backend team?

Git Flow / GitHub Flow / Trunk-based — Main branches: main + develop / main / main; Feature branch lifetime: days to weeks / 1-3 days / hours, sometimes no branch; Release: through a release branch / every merge from main / from main, often; Fits: boxed products, mobile apps, supporting several versions / web services…

📖 Answer

Git Flow GitHub Flow Trunk-based
Main branches main + develop main main
Feature branch lifetime days to weeks 1-3 days hours, sometimes no branch
Release through a release branch every merge from main from main, often
Fits boxed products, mobile apps, supporting several versions web services mature CI/CD, strong tests

The problem with Git Flow is that there are many merges, a gap builds up between develop and main, and a hotfix has to be merged in two places. For a microservice deployed several times a week, this is excess load.

Trunk-based gives the fastest feedback, but it demands a lot: reliable tests on every commit, feature flags, fast rollback. If the tests are weak, main stays red all the time.

For a Spring Boot team of 5-6 people I start with GitHub Flow: a protected main, short feature branches, PR + CI, an automatic deploy to staging after the merge, and a tag for prod. Once the team and the tests mature, moving toward trunk-based is easy.