Gitflow is a Git branching model first described by Vincent Driessen in 2010 in "A successful Git branching model". It gives every kind of work its own kind of branch, so new features, release preparation and urgent production fixes never get in each other's way.
develop gets the fix too.The five branch types
| Branch | Purpose |
|---|---|
main | Always matches production. Every commit here is a release and gets a version tag. |
develop | The integration branch. Finished features land here; it holds what will be in the next release. |
feature/* | One branch per feature, from develop, merged back into develop. |
release/* | Freezes a version for final testing and version bumps. Merged into main (tagged) and back into develop. |
hotfix/* | Urgent production fixes, from main. Merged into main (tagged) and develop. |
How a release happens
- Developers branch
feature/*offdevelopand open pull requests back into it. - When
developholds enough for a release, someone cutsrelease/1.2.0. - The release branch gets only bug fixes, version bumps and changelog updates. Feature work continues on
developin parallel. - The release merges into
mainand gets taggedv1.2.0. It also merges back intodevelop. - If production breaks, a
hotfix/1.2.1branches frommain, then merges intomainanddevelop.
See every command in The Gitflow workflow, step by step or the cheat sheet.
Pros and cons
Strengths
- Clear rules: everyone knows where work goes.
- Several versions can be stabilised and supported at once.
mainis always releasable and fully tagged.- Fits release trains, app-store reviews and customer-installed software.
Weaknesses
- More branches, more merges, more ceremony.
- Long-lived feature branches drift and cause painful merges.
- Slows teams that deploy continuously.
- Release and hotfix branches have to be merged twice; forgetting one loses fixes.
Is Gitflow still a good idea?
It depends on how you ship. In 2020 Driessen added a note to his original post: for web apps that are continuously delivered, a simpler workflow like GitHub Flow is often a better fit. Gitflow remains a strong choice when you ship explicitly versioned software, or when you must support more than one version in the wild.
Rule of thumb: if "release" means pressing deploy, use something simpler. If "release" means a version number your users install, Gitflow earns its keep.
Compare Gitflow with GitHub Flow, trunk-based development and GitLab Flow →