
Short answer: use GitHub Flow if you deploy a web app continuously, trunk-based development if you deploy many times a day with strong CI and feature flags, and Git Flow only if you ship versioned releases and support more than one version at a time.
This guide explains how each workflow works, the exact commands, how each one fits with CI/CD, and how to pick. This article is part of our complete Git and GitHub Actions workflow guide.
Once you have picked a workflow, see Git best practices for branching and approvals for the protection rules that enforce it.
What Is a Git Workflow?
A Git workflow is a team agreement about which branches exist, how long they live, and how code moves from a developer’s machine to production. Git itself does not enforce any of it; you enforce it with branch protection rules, pull request reviews and CI.
The three workflows below differ mainly in one thing: how long branches live before they merge. The longer branches live, the more structure you get and the more painful merges become.
What Is Gitflow? (Git Flow Explained)
Gitflow (also written Git Flow) is a branching model with two long-lived branches, main and develop, plus short-lived feature, release and hotfix branches.
Git Flow was introduced by Vincent Driessen in 2010. It uses two long-lived branches plus three kinds of short-lived ones:
main: production releases only, each one taggeddevelop: integration branch where finished features collectfeature/*: branched from and merged back intodeveloprelease/*: branched fromdevelopto stabilize a version, merged into bothmainanddevelophotfix/*: branched frommainfor urgent fixes, merged into both
Commands
# start a feature
git switch -c feature/new-feature develop
# cut a release
git switch -c release/1.4 develop
# finish the release: merge to main, tag it, merge back to develop
git switch main && git merge --no-ff release/1.4
git tag -a v1.4.0 -m "Release 1.4.0"
git switch develop && git merge --no-ff release/1.4
# urgent production fix
git switch -c hotfix/1.4.1 main
Good for: desktop and mobile apps, libraries, on-prem software, anything where customers run several versions at once. Costs: two long-lived branches drift apart, merges get large, and releases are slower.
Worth knowing: Driessen added a note to the original post in 2020 saying that for continuously delivered web apps, a simpler workflow like GitHub Flow is a better fit. Git Flow was never meant as the default for everything.
GitHub Flow
GitHub Flow keeps one long-lived branch, main, which is always deployable. Every change is a short feature branch, reviewed in a pull request, then merged and deployed.
git switch -c feature/new-feature main
# ...commit your work...
git push -u origin feature/new-feature
# open a pull request, get review and green CI, then merge
Good for: web apps and services that deploy continuously, open-source projects, small to mid-size teams. Costs: there is no built-in staging branch, so you need preview environments or a deploy step that runs before merge. Busy repos also hit “main moved while my PR was waiting” problems, which merge queues solve (below).
Trunk-Based Development
In trunk-based development, everyone integrates into main (the trunk) at least daily. Branches, if used at all, live for hours. Unfinished work ships to production hidden behind feature flags.
git switch -c fix/login-bug main
# small change, tests pass locally
git push -u origin fix/login-bug
# short PR, merged the same day; release by flipping a flag, not by merging a branch
Good for: high-velocity teams with fast, reliable automated tests and a feature-flag system. Costs: it only works if CI catches problems before they hit main. Without that, trunk-based development just means breaking production more often.
Side-by-Side Comparison
| Git Flow | GitHub Flow | Trunk-Based | |
|---|---|---|---|
| Long-lived branches | main + develop | main | main |
| Typical branch lifetime | Days to weeks | Hours to a few days | Hours |
| Release model | Versioned releases | Deploy on merge | Continuous, behind flags |
| Supports multiple live versions | Yes | Not really | No |
| Merge conflicts | Frequent and large | Occasional | Rare and small |
| CI/CD requirement | Moderate | Solid | Very strong |
| Best for | Versioned products | Most web teams | High-velocity teams |
How Each Workflow Fits CI/CD
- Git Flow: run CI on every PR into
develop, deploydevelopto staging, and deploy to production when a tag lands onmain. Our guide to Git tags and releases covers the tagging side. - GitHub Flow: run CI on every pull request, require it to pass through branch protection, and deploy on push to
main. A GitHub Actions workflow triggeredon: push: branches: [main]is the whole pipeline. See our GitHub Actions workflow YAML guide. - Trunk-based: same as GitHub Flow, but CI must be fast (minutes, not an hour), and a merge queue is close to mandatory once several people merge per hour.
Merge queues
On a busy main, two PRs can each pass CI on their own and still break main together. A merge queue (built into GitHub, GitLab and others) fixes this by testing each PR against the latest main plus everything ahead of it in the queue before merging. If you run GitHub Flow or trunk-based development with more than a handful of developers, turn it on.
How to Choose
- Do you support several released versions at once? Yes: Git Flow (or a simple release-branch variant of GitHub Flow).
- Do you deploy a web app or service? Start with GitHub Flow.
- Do you deploy many times a day, with fast tests and feature flags? Move to trunk-based development.
You can change later. Workflows are conventions, not tools, and many teams start with Git Flow, drop develop as their CI improves, and end up at GitHub Flow or trunk-based development.
Frequently Asked Questions
GitHub Flow, a single main branch plus short-lived feature branches, is usually the best fit for small teams practising continuous deployment.
Git Flow uses long-lived develop and release branches for scheduled releases; trunk-based development keeps everyone committing to one branch behind feature flags for continuous delivery.
It still suits products with versioned releases and several supported versions, but most web teams have moved to GitHub Flow or trunk-based development.
Yes. Workflows are conventions, not tools, so a team can move from Git Flow to trunk-based development as its release cadence changes.
Get the next guide by email
New DevToolHub guides on Git, GitHub Actions, Claude Code and cloud tools, emailed as they publish: about one a weekday. I run the commands before I write them up. The Git + GitHub Actions cheat sheet is a free PDF, no signup needed.
You Might Also Like
- 👉 Day 1: Git Fundamentals
- 👉 Day 2: Basic Git Workflow
- 👉 Day 3: Branching and Merging
- 👉 Day 4: Remote Repositories
- 👉 Day 5: Advanced Git Operations
- 👉 Git Recover Lost Commits: 12 Fixes for Common Mistakes
- 👉 Advanced Git Commands You Need to Master (With Examples)
- 👉 Git Best Practices for Branching and Approvals
- 👉 GitHub CODEOWNERS & Permissions: Best Practices with Teams
- 👉 Git Hooks Explained: Automate Your Workflow with Examples
- 👉 Git Tags and Releases Best Practices: A Complete Guide