Git Flow vs Trunk-Based Development: A Fair Comparison

Contents

TL;DR

  • Git Flow with one branch per environment (dev → qa → prod) gives you three versions to keep in sync, unclear rules for how a change gets promoted, and hotfixes that come back as bugs if nobody back-merges them.
  • Count the CI runs: a change that is promoted on its own goes through 6 runs to reach prod in that setup, and 2 with trunk-based. Promotion PRs often batch several changes, so the real figure sits between the two. It is the worst case for hotfixes and urgent re-pins of a shared library.
  • None of the big companies I looked at (Google, Meta, Amazon, Microsoft, Uber, Shopify, GitHub, Spotify) branches per environment. They all integrate on one main line; the difference is whether they cut release branches from it.
  • Trunk-based isn’t free: it needs pipelines built for it, a merge queue, small PRs and flags. DORA’s 2023 data says its delivery gains come through continuous delivery, and links it to more burnout. Git Flow keeps a lower setup cost and wins when you ship several versions.
  • In my experience, safety is the same in both: hotfix and/or rollback. On balance, for backend services in 2026, I prefer trunk-based.

This post compares Git Flow and trunk-based development as fairly as I can: from working with both, and from how large engineering organisations handle the same problem. It’s for backend developers whose branches are named after their environments and who are wondering whether to change.

The numbers below are worked examples, not measurements from a specific team: plug in your own.

The two models in one minute

Git Flow (Vincent Driessen, 2010) uses long-lived branches: develop for integration, main for what’s released, plus feature/*, release/* and hotfix/* branches that merge back into them. Many teams adapt it to one long-lived branch per environment, which is the setup this post is about.

Trunk-based development (trunkbaseddevelopment.com) has one shared branch, the trunk (main). Everyone merges small changes into it at least once a day through short-lived branches that live hours, not weeks. Environments are deployment targets, not branches.

AspectGit Flow (branch per environment)Trunk-based
Long-lived branches3 (dev, rc/qa, prod)1 (main)
What’s in each environmentA different branch, so a different versionA commit (or tag) of main, promoted when it’s ready
How a change movesPRs and merges between branchesThe pipeline deploys the same build to the next environment
Release / stable checkpointThe state of the prod branchA tag on main
HotfixFix on prod, then back-merge to rc and devFix on main, tag, deploy
Unfinished workWaits in a branch that hasn’t been promotedHidden behind a feature flag

Here’s the same difference drawn out, hotfix included:

Git Flow with a branch per environment, next to trunk-based developmentGit Flow: three long-lived branches, dev, qa and prod, with changes merged from dev to qa to prod. A hotfix made on prod has to be merged back into qa and dev. Trunk-based: one main branch with short-lived branches that merge back within hours. A tag on main marks a release, and one build of that tag is deployed to dev, then promoted to qa and prod.Git Flow · three branches, three versionsTrunk-based · one branch, one builddevqaprodmaindeployhotfixback-mergev1.3devqaprodThe same artifact moves from dev to prod. Nothing is rebuilt.

Where Git Flow hurts

Three environments, three versions

Three environments, dev → qa → prod, each fed by its own branch. Each of them runs a different version of the code. “Does this bug happen in qa?” starts with working out which commits qa actually has.

The way a change gets promoted is ambiguous

How does a change go from dev to the release candidate? Every team I’ve seen answers it differently:

  • Merge dev into the RC branch? Then everything in dev goes with it, finished or not.
  • Open a PR against both dev and the RC? Then you review and merge the same change twice, and the two copies can drift.

Both answers come with an RC branch you now have to maintain.

Hotfixes have to travel backwards

A hotfix in prod has to be merged back into dev and the RC. If nobody does it, the next release overwrites the fix and the bug comes back. Most of the time someone (or a coding agent) back-merges right after the hotfix. “Most of the time” is the problem: when it’s forgotten, nothing flags it, and it becomes one more thing someone has to keep an eye on.

CI multiplied by three

With a big team, PRs and commits arrive in batches. Dependency re-pins (bumping the version of a shared library in each service that uses it) hit all three branches. Every change runs the pipeline on the PR and on the merge, at every hop:

CI runs for one change to reach prodGit Flow with three environment branches needs 6 runs: a PR run and a merge run for dev, qa and prod. Trunk-based needs 2: a PR run and a merge run on main.Git Flow · 6 runsTrunk-based · 2 runsdevqaprodmainRun 1: PR into devRun 2: merge into devRun 3: PR dev → qaRun 4: merge into qaRun 5: PR qa → prodRun 6: merge into prodRun 1: PR into mainRun 2: merge into mainPRmergePRmergePRmergePRmergeEach block is one full CI run (lint, tests, build).

So, for a change promoted on its own, trunk-based needs about a third of the CI runs. That’s arithmetic on the two models, not a measurement: 6 runs against 2. The 6 assumes no batching. Promotion PRs (dev → qa, qa → prod) usually carry several changes at once, and runs 3 to 6 are then shared, so the per-change cost is about 2 + 4/N for N changes per promotion: 6 runs at N=1, 3 at N=4, 2.4 at N=10. The gap is widest for the changes you promote alone: hotfixes and urgent re-pins. Deploy jobs don’t shrink (you still deploy to three environments in both), but the lint, test and build runs on transitory PRs between branches disappear.

Put a time on it. If one CI run takes 15 minutes, a change promoted alone costs 6 × 15 = 90 minutes of CI to reach prod, against 2 × 15 = 30 minutes. The bigger cost is the queue: when dozens of PRs are waiting, every transitory PR between branches makes the wait longer for everyone, and CI starts blocking development. With trunk-based and build-once-promote, the build runs once per change, and moving it to the next environment is only a deploy, usually a couple of minutes, because nothing is rebuilt.

Re-pins make the gap visible. Bumping a shared library’s version in every service that uses it (in a Python service, the pin in pyproject.toml and the resolved version in uv.lock) is one change per service. Say one library gets a fix that 20 services need. If each service promotes it alone, Git Flow costs 20 × 6 = 120 runs (30 hours of CI at 15 minutes each) to get it to prod, against 20 × 2 = 40 runs (10 hours) with trunk-based in separate repos. If the re-pin rides along with promotions you were doing anyway, the extra cost in Git Flow falls toward the 2 runs of the first hop, and the gap mostly closes. If your libraries release every sprint, repeat it every sprint. In a monorepo it’s a single PR, though some of that win comes from the monorepo, not from trunk-based (see Limits).

What trunk-based would change

With one long-lived branch, CI/CD works per commit. Every merge to main builds one artifact. That artifact goes to dev, and the same artifact is promoted to qa and prod. Nothing is rebuilt from a different branch, and a re-pin happens once per repo, not once per repo per environment branch.

No release branches: tags and pipelines

Plenty of trunk-based teams cut release branches from main (branch for release), and some very large ones do (see the next section). If you do cut them, what matters is which way changes flow. Microsoft’s Release Flow cuts a release branch at the end of every sprint, and “release branches never merge back to the main branch”: a fix lands on main first and is cherry-picked out. Cutting a branch from main to ship it is fine. Merging it back is the Git Flow habit that causes the drift above.

For a backend team that deploys its own services, I don’t think you need them. Every commit on main is already a candidate, and a tag is enough to mark a release or a stable checkpoint. The logic moves from branches to what you deploy, which is pipeline work.

Here’s a simplified GitHub Actions sketch with two workflows. Every commit on main is built once and deployed to dev:

# .github/workflows/main.yml
on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: astral-sh/setup-uv@v10.3.2
      - run: uv sync --locked
      - run: uv run pytest
      # registry login omitted
      - run: docker build -t registry.example.com/app:${{ github.sha }} .
      - run: docker push registry.example.com/app:${{ github.sha }}

  deploy-dev:
    needs: build
    environment: dev
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - run: ./deploy.sh dev ${{ github.sha }}

A tag decides what gets promoted: v1.4.0-rc.1 goes to qa, v1.4.0 goes to prod. The image is re-tagged, never rebuilt:

# .github/workflows/promote.yml
on:
  push:
    tags: ["v*"]

jobs:
  promote:
    runs-on: ubuntu-latest
    # optional: add required reviewers to the "prod" environment in the repo settings
    environment: ${{ contains(github.ref_name, '-rc') && 'qa' || 'prod' }}
    steps:
      - uses: actions/checkout@v7
      # registry login omitted
      - run: >
          docker buildx imagetools create
          -t registry.example.com/app:${{ github.ref_name }}
          registry.example.com/app:${{ github.sha }}
      - run: ./deploy.sh ${{ contains(github.ref_name, '-rc') && 'qa' || 'prod' }} ${{ github.ref_name }}

Many Git Flow teams already tag releases, so this part is rarely new. What changes is that “everyone agrees it’s safe in qa” becomes pushing the release tag. The tag points at a commit on main, and the re-tag step only works for a commit that was built there, so a tag on a commit that was never built fails, which is the guard you want. Nothing checks that v1.4.0 is on the same commit as the last -rc that passed qa, though. Add a step that fails the prod job unless git rev-parse v1.4.0^{commit} equals the commit of the matching -rc tag, or the claim “what passed in qa is what reaches prod” depends on people tagging carefully. Protect v* tags in the repo settings too: anyone who can push one deploys to prod. Rolling back means deploying the previous tag again: ./deploy.sh prod v1.3.2.

If prod needs a human approval, put it on the prod environment as a required reviewer, not in a branch merge. An approval is only worth something if the approver sees what’s going out: the commits since the last tag, any database migrations, and the test results from qa. Without those, the approval only adds a wait. On GitHub Free, Pro and Team plans, required reviewers only work on public repos.

Note: action versions and syntax change over time (this was written in October 2026). The idea that lasts is build once, tag to release, promote the same artifact.

The trade-off: without release branches, main must always be releasable, because the next tag takes everything merged so far. That’s what the next sections are about.

How big companies do it

I looked at what large engineering organisations have published about branching and releasing. Two caveats first: these are their own blog posts, papers and docs, written by teams proud of their system, and their scale is not most teams’. What’s useful is the problems they ran into, because we hit smaller versions of the same ones.

CompanyMain lineRelease branches?How changes reach users
GoogleOne monorepo, trunk-based (CACM, 2016)Yes, for many projects: cut from mainline at a revision, never merged back (SRE book)Fixes land on mainline first, then get cherry-picked into the release branch
Meta (web)MasterDropped in 2016–2017 (Rapid release at massive scale)Push from master every few hours: employees, then 2% of traffic, then 100%, with Gatekeeper flags
AmazonMainline per serviceNot describedOne build, packaged and signed once, promoted through alpha, beta, gamma, one-box and production waves (Builders’ Library)
Microsoft (Azure DevOps)Master, short-lived topic branchesYes, one per sprint (Release Flow)Hotfix to master first, then cherry-pick the PR into the release branch
UberA few large monoreposNot describedSubmitQueue keeps main green; CD deploys the newest commit that passes each stage (2024)
ShopifyMaster of the Rails monolithNo, master stays close to productionMerge queue in batches of 8 PRs, about 400 commits a day (2019)
GitHubMain of the big monorepoNot describedMerge queue, about 2,500 PRs a month (2024)
Spotify (mobile app)MainYes, one a week (2025)Only critical fixes on the branch; unfinished work behind flags
Chromium / Apple’s SwiftMainYes, per milestone (Chromium, Swift 6.4)Main-first; merges to the release branch need approval

A few gaps: Apple doesn’t publish how its internal teams branch, so the Swift row is the closest public view. Netflix, Stripe and Anthropic haven’t published a branching model I could find. Netflix talks about a cross-repo testing service because “a simple change to a shared library could have impact to dozens of critical services”. Stripe is reported to auto-deploy almost every service with gradual rollouts. The Claude Code team at Anthropic was reported in September 2025 to ship 60–100 internal releases a day, with engineers opening about 5 PRs each per day over that summer.

What stands out: nobody in that list branches per environment. Everyone integrates on one main line. The real split is between teams that ship versioned software (Chrome, Swift, mobile apps, products released per sprint), who cut release branches from main, and teams that run their own services (Meta web, Amazon, Uber, Shopify, GitHub), who deploy main directly.

What they ran into, and how they fixed it

ProblemWhoWhat they did
Cherry-picks don’t scaleMeta: 500–700 cherry-picks a day, weekly branches of up to 10,000 diffsPush from master continuously, in tiers, with flags
Forgotten back-mergesMicrosoft: fixing the release branch first risks never bringing the fix backFix on master first, cherry-pick outwards
Main breaks when many PRs landUber, Shopify, GitHubA merge queue that tests each PR against the future main
Batches too big to debugGitHub “trains” of up to 15 PRs, waits of 8+ hours; Shopify capping batches at 8Smaller batches through the merge queue (GitHub cut wait time by 33%)
A shared library change breaks many servicesUber (a shared RPC library), NetflixRoll out to the least important services first, stop on cross-service failure signals, test across repos, lock dependency versions
A bad deploy reaches everyoneAmazon, MetaOne-box first, waves, bake time, automatic rollback on alarms
Unfinished features on mainMeta, SpotifyFeature flags

Two of those rows are the Git Flow problems from earlier, at a much bigger scale: back-merges and shared library re-pins. The fixes the big companies landed on all point the same way: one main line, fixes go out from it and never back into it, and the pipeline does the promoting.

The case against trunk-based

  • On its own, it doesn’t do much. The 2023 State of DevOps report found that trunk-based development has only a minor effect on software delivery performance, and that the effect runs completely through continuous delivery. If you adopt trunk-based without the pipeline, you pay the costs below and get little back. Faster code reviews did far better in the same report: teams with them had 50% higher delivery performance.
  • It can burn people out. The same report linked trunk-based development to a substantial increase in burnout, with no effect on job satisfaction or productivity. The report doesn’t fully explain why. My guess is that it’s adopting trunk-based without fast CI, quick reviews and good docs, but that’s my reading, not DORA’s.
  • The setup cost is real. New pipelines for every service and library, a merge queue, auto-merge and flag tooling before you see any benefit, plus a transition period where both models run side by side. Git Flow works with the pipelines a team already has. It’s usually the first objection, and it’s fair.
  • Git Flow releases are clean. This is the strongest argument for staying. With branch-per-environment, you know exactly what goes to prod: whatever was promoted, and nothing else. In trunk-based, the next tag takes everything on main, including a colleague’s change you didn’t know about, so releases are only as clean as your feature flags. Without flag tooling this argument wins.
  • It needs discipline every day. Small PRs, flags with owners, a main that’s always releasable. Git Flow lets you be sloppy for longer before it hurts.
  • Flags are debt. Every flag is a branch in your code instead of in git, and someone has to remove it.

None of these are reasons to stay on Git Flow forever, but they’re reasons to migrate with the supporting pieces in place, not just by deleting branches.

“Isn’t trunk-based riskier?”

This is the objection I’d expect next, and in my experience the answer is no, it’s the same. When something breaks in prod you do what you always do in both models: hotfix and/or roll back. With trunk-based, the hotfix is a normal PR to main followed by a new tag, and the rollback is a redeploy of the previous tag.

What changes is the kind of incident:

AspectGit FlowTrunk-based
Typical causeDrift between environments: a feature or fix that didn’t get promoted, or a missing back-mergePromoting a colleague’s change you didn’t know about, before it’s stable
Why it happensEvery environment is a different branch, and promotion is manualThe next tag takes everything on main
FixFind which branch is missing what, then merge or back-mergeA fix PR, or a flag turned off
PreventionDiscipline on every promotionSmall PRs, feature flags, and telling the team before you tag

The Git Flow incidents are structural: they come from having three versions. The trunk-based one is a communication problem, and usually a quick fix PR solves it. If a colleague’s unfinished change is the risk, the flags and small PRs below are the answer.

Rolling back doesn’t roll back the database

“Redeploy the previous tag” only undoes code. If v1.4.0 renamed a column, v1.3.2 starts against a schema it doesn’t know. And if migrations run before the new pods start (an init container or a pre-deploy job), the old version keeps serving traffic against the new schema for the whole rollout.

So every schema change has to work with both the version before it and the version after it. The usual pattern is expand, then contract: add the new column, deploy code that writes to both, backfill, switch reads, and only remove the old column in a later release. Stripe’s write-up on online migrations splits it into four phases: dual writing, changing all read paths, changing all write paths, removing old data. This applies to Git Flow too, but trunk-based ships more often, so you’ll run into it more.

When you have to patch an old tag

Sometimes main has moved on and isn’t ready to ship, but prod needs a fix now. You branch from the tag in prod, fix it, and tag v1.3.3 there. That tag isn’t reachable from main, so a tool that works out the next version from the tags on main can propose v1.3.3 again. Land the fix on main first, as usual, and make sure main’s next release goes past the patch (v1.4.0, or set the version by hand).

What trunk-based needs to work

Removing branches doesn’t remove the problems they were solving. Something else has to solve them:

  • DevOps pipelines built for it. This is the biggest piece of work. Build once, deploy main to dev on every commit, promote by tag, roll back by tag. Expect to rebuild every pipeline around this model.
  • Fast, reliable CI. Everyone merges into one branch, so a red or slow main blocks everyone.
  • Fast code review. Small PRs only stay small if they’re reviewed in hours, not days. In DORA’s 2023 data, review speed mattered more than the branching model itself.
  • Small PRs, merged at least daily. DORA’s research on trunk-based development describes teams with three or fewer active branches that merge into trunk at least once a day. Big PRs hurt more here. The branch stops being short-lived while it waits for review, and you rebase again. Reviews get worse, not just slower: a SmartBear study of code reviews at Cisco found reviewers catch fewer defects once a review passes about 200 to 400 lines. And since every merge reaches an environment, a big merge is a big deploy that’s hard to debug and revert, and it lands on everyone’s next tag. Split the work into PRs that each leave main releasable, with the unfinished parts behind a flag.
  • A merge queue. A big PR is more likely to conflict with the ones ahead of it, and a failure re-tests everything behind it. When many PRs land at once, a merge queue tests each one against the future main, so two green PRs can’t combine into a red trunk.
  • Auto-merge. With auto-merge, a PR merges itself once reviews and checks pass. Combined with a dependency bot that opens the re-pin PRs (instead of people or agents doing it by hand), a library bump across 20 services stops being a day of clicking.
  • Feature flags for unfinished work. Code that isn’t ready ships turned off. This one is a hard prerequisite: without flags, the “clean releases” argument above wins. Hosted flag services and open-source options both work.
  • Rules for removing flags. Pete Hodgson’s feature toggles article splits flags into release, experiment, ops and permission toggles. The release toggles you need for trunk-based should live days or weeks, not years. Give every flag an owner and an expiry date, and consider the article’s harder options: a “time bomb” test that fails once a flag outlives its date, or a cap on how many flags can exist at once. Uber built Piranha to delete stale-flag code automatically and had removed about 2,000 stale flags with it by 2020. A small team can do this by hand, as long as somebody actually does it.
  • A careful path for shared libraries. A library release now reaches every service quickly. Uber’s answer was to roll such changes out to the least important services first and stop if many of them fail. In practice: bump a library in one or two low-risk services before the dependency bot opens the other PRs.

When Git Flow still makes sense

Git Flow fits a specific kind of project. In his 2020 note of reflection, Driessen says the model targets explicitly versioned software, and that teams continuously delivering a web app should use something simpler.

If you ship several supported versions (libraries, on-prem installs, mobile apps), you need a line per version: Git Flow, or trunk-based with release branches. Git Flow also wins on setup cost and on isolation from colleagues’ unfinished work. Trunk-based wins on what happens every day: CI, drift, hotfixes and re-pins.

Limits of this comparison

  • It’s practical experience plus published accounts from companies far bigger than most teams. It’s not a controlled study.
  • Branching isn’t the only variable. Trunk-based often comes with a monorepo and better pipelines, and some of the wins (a re-pin in a single PR, fast CI) belong to those, not to the branching model. A monorepo is a separate decision.
  • The CI figure is arithmetic on the two models, not a measured before/after, and it assumes no batching of promotions. Real savings depend on how heavy each run is, how many changes share a promotion and how often you hotfix.
  • The “Git Flow” here is the branch-per-environment variant. Classic Git Flow with a single develop has fewer branches, but the same back-merge problem.
  • The company accounts are self-reported, some are several years old, and a few (Stripe, Anthropic) are second-hand reporting.
  • Every company in the list is large. I couldn’t find published evidence comparing the two models for a small team. The advice for small teams is my extrapolation from big-company accounts.
  • Watch who’s writing. A lot of what you’ll find online about trunk-based development, flags and merge queues comes from companies that sell flag services or merge queues. I’ve leaned on DORA, the companies’ own engineering posts and tool docs, but read vendor guides with that in mind.

Conclusion

Both models work, and both are used by serious teams. Still, I prefer trunk-based, and I think it’s the better fit for how most backend teams work in 2026. Services deploy many times a day, not once a quarter. AI agents mean more PRs per engineer, and more PRs are only manageable when they’re small and merge quickly. And every large organisation in the list above that runs its own services has converged on the same shape: one main line, fixes going outwards, and a pipeline that promotes the same build. Branches per environment buy isolation, and pay for it with drift, back-merges and up to three times the CI. Tags and pipelines give you the same control for less.

If you’re considering the move, don’t switch everything at once. Agree as a team on a pilot first: which services, for how long, and what counts as success. Good measures are CI wait time, CI runs per change, missed back-merges and incidents caused by a release. Measure before and after, so the decision rests on numbers instead of arithmetic.

References

Back to all Posts