The model

What is Gitflow?

A branching model for Git with two permanent branches and three kinds of short-lived ones. It's built for software that ships in versioned releases.

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.

The Gitflow branching modelmain holds tagged releases. develop branches from main. A feature branch comes off develop and merges back. A release branch comes off develop, then merges into main (tagged v1.1) and back into develop. A hotfix branch comes off main, then merges into main (v1.0.1) and develop.mainhotfix/*release/*developfeature/*v1.0v1.0.1v1.1
Time flows left to right. Solid lines are branches; dotted lines are "merge back" so develop gets the fix too.

The five branch types

BranchPurpose
mainAlways matches production. Every commit here is a release and gets a version tag.
developThe 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

  1. Developers branch feature/* off develop and open pull requests back into it.
  2. When develop holds enough for a release, someone cuts release/1.2.0.
  3. The release branch gets only bug fixes, version bumps and changelog updates. Feature work continues on develop in parallel.
  4. The release merges into main and gets tagged v1.2.0. It also merges back into develop.
  5. If production breaks, a hotfix/1.2.1 branches from main, then merges into main and develop.

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.
  • main is 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 →