3 / 11 · Book 17 · Branching Strategies← prev⊞ allnext →Get the book →
1.3GitFlow in Detail
GitFlow, introduced by Vincent Driessen in 2010, uses two long-lived branches (main and develop) plus short-lived branches for features, releases, and hotfixes. It is the most structured of the three strategies.
main ──────────────*───────────────────*──────── (production releases)
^ ^
release/2.3 ──────* release/2.4 ────*
^ ^
develop ───*──*──*─┘──*──*──*──*──*───┘──*──── (integration branch)
^ ^ ^ ^ ^ ^ ^ ^ ^
feature branches (short-lived)
How GitFlow Works
mainalways reflects the current production state. Every commit onmainis a release.developis the integration branch. All feature branches merge here.- Feature branches branch from
developand merge back todevelopwhen complete. - Release branches (
release/2.4) branch fromdevelopwhen the team is ready to prepare a release. Only bug fixes go on the release branch -- no new features. - Hotfix branches (
hotfix/2.3.1) branch frommainfor urgent production fixes. They merge to bothmainanddevelop.
Implications for Testing
- Test on
develop: Every feature merged todevelopshould trigger regression tests. - Test again on
release/*: The release branch is for stabilization. Each bug fix on the release branch needs testing. - Double testing burden: You may test a feature on
developand then test the same feature again on the release branch. - Hotfix testing: Hotfixes branch from
main, get tested in isolation, then merge to bothmainanddevelop. - Environment mapping:
developmaps to a dev/integration environment,release/*maps to staging,mainmaps to production.
When to Use GitFlow
- Your product has scheduled releases (quarterly, monthly).
- Multiple versions are supported simultaneously (v2.3 and v2.4 both in production).
- Regulatory requirements demand a stabilization phase before release.
- Your team is large and needs the structure that multiple branches provide.
Pro Tip: GitFlow adds overhead. If you are deploying to production multiple times per day, GitFlow's release branches will slow you down. Use it when you genuinely need the stabilization phase, not because "that's how we've always done it."