What is GitFlow, and when would you use it?
BeginnerConceptBranching, versioning & releases
Answer
In one line: GitFlow is a branching model with two permanent branches — main for released code and develop for integration — plus temporary feature, release and hotfix branches; it suits products with planned, versioned releases.
The branches:
main— always reflects production releases; each release is tagged (v2.3.0).develop— the integration branch for the next release.feature/*— branched fromdevelop, merged back when done.release/*— branched fromdevelopwhen preparing a release; only bug fixes, version bumps and docs; merged into bothmainanddevelop.hotfix/*— branched frommainto fix urgent production bugs; merged into bothmainanddevelop.
Flow example:
feature/login → develop → release/2.3 → main (tag v2.3.0)
↘ develop
hotfix/2.3.1 from main → main (tag v2.3.1) + develop
When GitFlow fits:
- Software with scheduled releases (desktop apps, mobile apps, on-premise products).
- Several versions supported at the same time.
- Teams that need a stabilisation period before release.
When it doesn't fit:
- Web apps and services doing continuous delivery — GitFlow adds long-lived branches, delays integration and slows releases. Even its creator later suggested simpler flows for continuously delivered software.
Downsides:
- Complex; easy to merge into the wrong branch.
- Long-lived branches drift and cause big merges.
- Work waits in
developbefore reaching users.
Tip for interviews: show you know both its structure and its trade-offs: "GitFlow works for versioned releases; for a SaaS product with CI/CD, I'd prefer trunk-based or GitHub Flow."