View as Markdown

Mergify Stacks vs gh⁠-⁠stack

An honest comparison of Mergify Stacks and GitHub's gh-stack CLI for stacked pull requests.


GitHub released gh-stack, a stacking extension for the gh CLI. Both tools solve the same problem (big PRs are hard to review, so split them into a chain of small ones), but they take different approaches to get there.

The biggest difference is how each tool thinks about branches.

Mergify Stacksgh-stack
Local modelOne branch, many commitsOne branch per PR
IdentityChange-Id trailer in commit messageBranch name
Who manages branchesMergify auto-creates remote branchesDeveloper creates and names them
Mental model”Chain of commits""Chain of dependent branches”

Both produce the same result on GitHub: chained PRs where each targets the previous one’s branch. The difference is what you deal with locally.

Mergify Stacks: one branch, many commits

Section titled Mergify Stacks: one branch, many commits

You work on a single branch. Each commit maps to a PR automatically:

feat/auth A B C PR #1 base: main PR #2 base: PR #1 PR #3 base: PR #2

Under the hood, mergify stack push creates a remote branch per commit and chains the PRs:

Local CommitsRemote BranchesGitHub PRs A: add model stack/.../Ia1b2c3 PR #1 B: add endpoint stack/.../Id4e5f6 PR #2 C: add tests stack/.../Ig7h8i9 PR #3

You never see or manage these remote branches. They’re an implementation detail.

You create and name a separate branch for each change. Each branch becomes a PR that targets the branch below it:

m1 M m2 m1->m2 main a1 A m2->a1 a2 A' a1->a2 a3 a2->a3 feat/model b1 B a3->b1 b2 b1->b2 feat/endpoint c1 C b2->c1 c2 C' c1->c2 feat/tests

Three branches, three PRs: feat/model targets main, feat/endpoint targets feat/model, feat/tests targets feat/endpoint. You navigate between them with gh stack up and gh stack down.

FeatureMergify Stacksgh-stack
Create a stackmergify stack new + commitsgh stack init + gh stack add per branch
Push changesmergify stack pushgh stack push
Create PRsIncluded in mergify stack pushSeparate gh stack submit command
View the stackmergify stack listgh stack view
Edit mid-stackmergify stack edit (interactive rebase)Checkout the branch, edit, rebase
Reorder changesmergify stack reorder or mergify stack moveManual rebase + gh stack rebase
Squash changesmergify stack edit (squash/fixup)Manual
Cascading rebaseAutomatic on pushgh stack rebase --upstack / --downstack
Sync after mergemergify stack syncgh stack sync
Open PR in browsermergify stack open (interactive picker)Links from gh stack view
Collaborationmergify stack checkoutDifficult (force-push based)
Draft PRsmergify stack push --draftgh stack submit --draft
Merge QueueNative Mergify integrationGitHub’s built-in merge queue
Merge a stackBottom-up via Merge Queuegh stack merge (not yet implemented)
Stack visualizationStack comment on each PRNative GitHub UI stack map
Branch namingAuto-generated (configurable)Developer-chosen or auto-numbered
Navigate between PRsN/A (single branch)gh stack up / down / top / bottom
UnstackNot needed (standard Git branches)gh stack unstack
Atomic push--force-with-lease --atomic (all-or-nothing)--force-with-lease --atomic (all-or-nothing)
Conflict memoryGit’s native rerereBuilt-in automatic rerere
Pre-operation safetyGit reflogAutomatic branch snapshots before rebases
Exit codesStandardStructured (8 specific codes)

Simpler workflow. One branch, standard Git. You don’t create branches or navigate between them. You commit and rebase like you already do. The branching complexity lives on the remote side where you don’t have to think about it.

One command does more. mergify stack push rebases on the target branch, pushes all changes, and creates or updates PRs in a single command. With gh-stack, pushing and creating PRs are separate steps (push then submit).

Merge Queue depth. Mergify’s Merge Queue has batching, priority lanes, speculative checks, and queue freeze. gh-stack relies on GitHub’s built-in merge queue, which is more limited.

Collaboration support. mergify stack checkout lets a teammate pick up your stack locally and push changes. mergify stack sync pulls remote changes back down, so commits made by bots or review suggestions are incorporated automatically. With gh-stack’s force-push model, coordinating on the same stack is harder.

Merge works today. Stacked PRs land through the Merge Queue as each dependency merges. gh-stack’s merge command is listed in the docs but not yet implemented.

Native GitHub UI. gh-stack gets a stack map rendered directly in the PR interface. Mergify posts a stack comment on each PR, which works well but is a comment rather than a native UI element.

Platform lock-in. gh-stack is GitHub-only by design. Mergify’s stacking workflow also targets GitHub today, but the architecture isn’t tied to a single platform.

Distribution. gh-stack ships as a gh CLI extension and will likely get deeper GitHub integration over time. Mergify CLI is a standalone install (uv tool install mergify-cli).

Pricing. Both are free. Mergify Stacks is a standalone CLI that doesn’t require a Mergify subscription.

If you’ve been using gh-stack and want to try Mergify Stacks, the migration is straightforward. The main shift is moving from “one branch per PR” to “one commit per PR on a single branch.”

Terminal window
uv tool install mergify-cli
mergify stack setup

This installs the CLI and adds a commit-msg hook that generates Change-Ids for your commits. See the setup guide for details.

gh-stackMergify Stacks
gh stack initmergify stack new
gh stack add (create a branch)git commit (create a commit)
gh stack push + gh stack submitmergify stack push
gh stack up / downNot needed (single branch)
gh stack rebaseAutomatic on mergify stack push
gh stack syncmergify stack sync
gh stack viewmergify stack list

With gh-stack:

Terminal window
gh stack init
# work on first change
gh stack add
# work on second change
gh stack push
gh stack submit

With Mergify Stacks:

Terminal window
mergify stack new
git commit -m "first change"
git commit -m "second change"
mergify stack push

The result on GitHub is the same: two chained PRs, each showing one change.

Was this page helpful?