Choose

Compare Git workflows

Gitflow, GitHub Flow, trunk-based development and GitLab Flow. What each one is, who it suits, and how to choose.

GitflowGitHub FlowTrunk-basedGitLab Flow
Long-lived branchesmain, developmainmain (trunk)main + environment or release branches
Short-lived branchesfeature, release, hotfixfeaturevery short feature (≤ 1–2 days) or nonefeature
Release = a tagged versiona deploy of maina deploy of trunkpromotion through environments
CeremonyHighLowLowest (needs discipline)Medium
NeedsRelease manager habitsCI + quick reviewsStrong CI, feature flagsDefined environments
Best forApps, libraries, on-premSaaS & web appsFast, experienced teamsStaged deployments, regulated envs

Gitflow

Separate branches for features, releases and hotfixes, with develop as the integration branch. Structured and predictable. Full explanation →

GitHub Flow

One rule: main is always deployable. Branch from main, open a pull request, get review and green CI, merge, deploy. No develop, no release branches.

git switch -c fix-signup main
# commit, push, open PR → review → merge → deploy

Trunk-based development

Everyone integrates into the trunk (main) at least daily, either directly or through tiny branches that live for hours. Unfinished work hides behind feature flags, not branches. This needs excellent automated tests, but it nearly removes merge pain.

GitLab Flow

GitHub Flow plus branches that reflect where code is deployed (for example main → staging → production), or release branches like 2-3-stable for versioned software. Changes flow "downstream" by merging or cherry-picking.

How to choose

  1. Do users install a version? (mobile, desktop, library, on-prem) → Gitflow, or GitLab Flow with release branches.
  2. Do you deploy a web app whenever something merges? → GitHub Flow.
  3. Is CI strong, are feature flags in place, and do you want to merge many times a day? → Trunk-based.
  4. Must code pass through staging or pre-prod before production? → GitLab Flow (environment branches).

Start simple. It's easier to add a release branch when you need one than to remove ceremony your team has grown used to.