stackedprs.devStacked pull requests on GitHub

gh stack: which command builds, syncs and lands a stacked PR

gh stack is GitHub's CLI extension for native stacked pull requests: init, add and submit build a stack; rebase and push keep it current.

Install it with gh extension install github/gh-stack. gh stack link opens branches made in Jujutsu, Sapling or git-town as a stack, and gh stack merge lands everything up to the pull request you pick, all or nothing.

Updated December 3, 2026 · from GitHub's CLI reference, how-to pages and the gh-stack releases, read that day.

How do you install gh stack?

Run gh extension install github/gh-stack, sign in with gh auth login, and update later with gh extension upgrade stack. GitHub's two pages disagree on versions: the quickstart asks for GitHub CLI 2.90.0 and Git 2.20 or later, the CLI reference for GitHub CLI 2.0 and Git 2.36. Meet both: GitHub CLI 2.90.0 and Git 2.36.

For coding agents, GitHub publishes a skill: gh skill install github/gh-stack (quickstart). The extension has had 13 releases, from v0.0.1 on April 10, 2026 to v0.3.0 on October 26, 2026.

Which command creates a stack, and what does each one do?

gh stack init creates a stack, gh stack add puts the next branch on top, and gh stack submit pushes them and opens the linked pull requests. gh stack add -Am "message" stages, commits and starts the next branch in one step.

gh stack commands, from GitHub's CLI reference

CommandWhat it doesWhen you run it
gh stack initStarts a stack: creates or adopts the first branch on the trunkOnce, at the start
gh stack addAdds a branch on top of the current stackFor each next layer
gh stack viewShows every branch, its pull request, status and last commitAny time
gh stack checkoutChecks out a stack by stack number, PR number, URL or branchTo pick up a stack
gh stack modifyRestructures the stack: reorder, drop, insert, renameFrom a clean tree
gh stack unstackRemoves the stack on GitHub and locally (alias: delete)Before rebuilding a stack
gh stack submitPushes every branch, opens or updates the PRs and links the stackWhen layers are ready
gh stack syncFetches, rebases if the trunk moved, pushes and syncs PR stateTo catch up
gh stack rebaseCascading rebase from the trunk up (--upstack, --downstack)After a lower layer changes
gh stack pushPushes active branches in one atomic push, with --force-with-leaseAfter a rebase
gh stack linkLinks branches or PRs into a stack on GitHub, no local trackingFrom Jujutsu, Sapling or git-town
gh stack mergeMerges the stack up to a chosen PR, all or nothingTo land it
gh stack switch / up / downMoves between branches in the stackWhile working
gh stack top / bottom / trunkJumps to the top, the bottom or the trunkWhile working
gh stack alias / feedbackA short alias; feedback to GitHubRarely

What do gh stack rebase, sync and push each do?

rebase rewrites, push uploads, and sync does both only when the trunk moved.

  • rebase fetches, then rebases each branch onto the one below, from the trunk up. After a merged layer it switches to --onto by itself. --upstack stops at the top, --downstack at the current branch.
  • push sends every active branch in one atomic push with --force-with-lease. It never opens pull requests; submit does.
  • sync fetches, pulls in layers others added on GitHub, fast-forwards the trunk, rebases only if the trunk moved, pushes, and links the stack. On a conflict it puts every branch back and tells you to run rebase.

On github.com, the Rebase stack button does the same server-side and force-pushes each branch. GitHub's October 6 changelog says those commits are now signed; its Managing page still says server-side rebase commits are not, so rebase from the CLI if your repository requires signatures.

How do you fix a conflict mid-rebase?

Fix the files, stage them, and continue; the rest of the stack rebases on its own.

git add .
gh stack rebase --continue   # or: gh stack rebase --abort to put every branch back
gh stack push

A stopped gh stack modify has its own pair: gh stack modify --continue or --abort, which restores a snapshot taken before it started.

What can't gh stack do?

It can't stack across forks: every branch must be in the same repository. Stacks aren't in GitHub Desktop, and on github.com a reorder means unstacking and rebuilding, while gh stack modify reorders in place. gh stack merge can't bypass merge requirements.

Exit codes, for scripts and agents

Exit codeMeaning
0Success
1Generic error
2Not in a stack, or stack not found
3Rebase conflict
4GitHub API failure
5Invalid arguments or flags
6Branch belongs to more than one stack
7Rebase already in progress
8Stack is locked by another process
9Stacked pull requests are not enabled for this repository
10Modify session interrupted; recovery needed

GitHub's rollout guide says stacks need no setup or enablement, yet code 9 exists for a repository where they are not enabled; GitHub's docs don't say which setting causes it.

Which big projects already use stacks?

18 of the 100 most-starred repositories have a stacked pull request among their 100 most recently updated merged pull requests: 173 stacked of 9,309 read, in 69 stacks.

The repositories with the most stacked pull requests

RepositoryStacked PRsLargest stackStack base
react/react4523main
n8n-io/n8n1812master
immich-app/immich176main
vercel/next.js154canary
supabase/supabase157master
NousResearch/hermes-agent105main
microsoft/PowerToys1013main
langflow-ai/langflow83release-1.14.0
mattpocock/skills62main
langgenius/dify64main

Method. The 100 most-starred GitHub repositories with a programming language as their main language, not archived and not forks, read December 3, 2026. For each, GitHub's GraphQL API returned its 100 most recently updated merged pull requests with the read-only stack and stackEntry fields. A repository whose 100 pull requests reach back before the July 30 preview could not have stacked them all. Download the CSV (one row per repository, CC BY 4.0).

Where do these facts come from?

  1. GitHub: gh stack CLI commands
  2. GitHub: quickstart
  3. GitHub: managing stacks
  4. GitHub: reviewing stacks
  5. GitHub: troubleshooting
  6. GitHub: other tools
  7. GitHub: rolling out stacks
  8. GitHub changelog, October 6, 2026
  9. gh-stack releases
  10. GitHub: stack APIs