Interview Prep/DevOps Fundamentals/Branching, versioning & releases

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:

  1. main — always reflects production releases; each release is tagged (v2.3.0).
  2. develop — the integration branch for the next release.
  3. feature/* — branched from develop, merged back when done.
  4. release/* — branched from develop when preparing a release; only bug fixes, version bumps and docs; merged into both main and develop.
  5. hotfix/* — branched from main to fix urgent production bugs; merged into both main and develop.

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 develop before 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."

All DevOps Fundamentals questions

More on Branching, versioning & releases