🔀 Git & GitHub Intermediate

What is GitFlow workflow?

Why Interviewers Ask This

Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.

Answer

GitFlow is a branching model proposed by Vincent Driessen that defines a strict branching structure for managing releases. It uses two permanent branches and three types of supporting branches. Permanent branches: main (production-ready code, every commit is a release) and develop (integration branch for features). Supporting branches: (1) feature/* — branch off develop, merge back to develop when complete: git checkout -b feature/login develop; (2) release/* — branch off develop when ready for a release, only bug fixes allowed, merge into both main and develop when complete; (3) hotfix/* — branch off main for urgent production fixes, merge into both main and develop. Flow: feature → develop → release → main. Tags are created on main for each release. Pros: clear structure, good for scheduled releases, supports multiple versions. Cons: complex, too many long-lived branches, not suited for continuous deployment (CD) where you deploy frequently. Better alternatives for CD: GitHub Flow (simpler: one main branch, short-lived feature branches, deploy from PR) or trunk-based development (everyone commits to main daily, feature flags for in-progress work).

Pro Tip

This topic has Git & GitHub-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.