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.
Two Models for Stacking
Section titled Two Models for StackingThe biggest difference is how each tool thinks about branches.
| Mergify Stacks | gh-stack | |
|---|---|---|
| Local model | One branch, many commits | One branch per PR |
| Identity | Change-Id trailer in commit message | Branch name |
| Who manages branches | Mergify auto-creates remote branches | Developer 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 commitsYou work on a single branch. Each commit maps to a PR automatically:
Under the hood, mergify stack push creates a remote branch per commit and
chains the PRs:
You never see or manage these remote branches. They’re an implementation detail.
gh-stack: one branch per PR
Section titled gh-stack: one branch per PRYou create and name a separate branch for each change. Each branch becomes a PR that targets the branch below it:
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.
Feature Comparison
Section titled Feature Comparison| Feature | Mergify Stacks | gh-stack |
|---|---|---|
| Create a stack | mergify stack new + commits | gh stack init + gh stack add per branch |
| Push changes | mergify stack push | gh stack push |
| Create PRs | Included in mergify stack push | Separate gh stack submit command |
| View the stack | mergify stack list | gh stack view |
| Edit mid-stack | mergify stack edit (interactive rebase) | Checkout the branch, edit, rebase |
| Reorder changes | mergify stack reorder or mergify stack move | Manual rebase + gh stack rebase |
| Squash changes | mergify stack edit (squash/fixup) | Manual |
| Cascading rebase | Automatic on push | gh stack rebase --upstack / --downstack |
| Sync after merge | mergify stack sync | gh stack sync |
| Open PR in browser | mergify stack open (interactive picker) | Links from gh stack view |
| Collaboration | mergify stack checkout | Difficult (force-push based) |
| Draft PRs | mergify stack push --draft | gh stack submit --draft |
| Merge Queue | Native Mergify integration | GitHub’s built-in merge queue |
| Merge a stack | Bottom-up via Merge Queue | gh stack merge (not yet implemented) |
| Stack visualization | Stack comment on each PR | Native GitHub UI stack map |
| Branch naming | Auto-generated (configurable) | Developer-chosen or auto-numbered |
| Navigate between PRs | N/A (single branch) | gh stack up / down / top / bottom |
| Unstack | Not needed (standard Git branches) | gh stack unstack |
| Atomic push | --force-with-lease --atomic (all-or-nothing) | --force-with-lease --atomic (all-or-nothing) |
| Conflict memory | Git’s native rerere | Built-in automatic rerere |
| Pre-operation safety | Git reflog | Automatic branch snapshots before rebases |
| Exit codes | Standard | Structured (8 specific codes) |
Where Mergify Is Stronger
Section titled Where Mergify Is StrongerSimpler 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.
Where gh-stack Is Stronger
Section titled Where gh-stack Is StrongerNative 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.
Other Considerations
Section titled Other ConsiderationsPlatform 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.
Switching from gh-stack
Section titled Switching from gh-stackIf 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.”
Install and setup
Section titled Install and setupuv tool install mergify-climergify stack setupThis installs the CLI and adds a commit-msg hook that generates
Change-Ids for your commits. See the
setup guide for details.
Concept mapping
Section titled Concept mapping| gh-stack | Mergify Stacks |
|---|---|
gh stack init | mergify stack new |
gh stack add (create a branch) | git commit (create a commit) |
gh stack push + gh stack submit | mergify stack push |
gh stack up / down | Not needed (single branch) |
gh stack rebase | Automatic on mergify stack push |
gh stack sync | mergify stack sync |
gh stack view | mergify stack list |
Workflow before and after
Section titled Workflow before and afterWith gh-stack:
gh stack init# work on first changegh stack add# work on second changegh stack pushgh stack submitWith Mergify Stacks:
mergify stack newgit commit -m "first change"git commit -m "second change"mergify stack pushThe result on GitHub is the same: two chained PRs, each showing one change.
Was this page helpful?
Thanks for your feedback!