GitHub/gh-stack: GitHub Stacked PRs GitHub has released gh-stack, a GitHub CLI extension that automates stacked pull requests by managing branches, rebasing, and PR base branches. The tool, installable via `gh extension install github/gh-stack`, requires GitHub CLI v2.0+ and supports commands like `gh stack init`, `add`, `push`, `view`, and `submit` to create linked PRs. Stack metadata is stored locally in `.git/gh-stack`, and the extension also offers a skill for AI coding agents. A GitHub CLI extension for managing stacked branches and pull requests. Stacked PRs break large changes into a chain of small, reviewable pull requests that build on each other. gh stack automates the tedious parts — creating branches, keeping them rebased, setting correct PR base branches, and navigating between layers. gh extension install github/gh-stack Requires the GitHub CLI https://cli.github.com/ gh v2.0+. Install the gh-stack skill so your AI coding agent knows how to work with stacked PRs and the gh stack CLI: gh skill install github/gh-stack Start a new stack creates and checks out the first branch gh stack init ... make commits on the first branch ... Add another branch on top gh stack add api-endpoints ... make commits ... Push all branches gh stack push View the stack gh stack view Open a stack of PRs gh stack submit A stack is an ordered list of branches where each branch builds on the one below it. The bottom of the stack is based on a trunk branch typically main . frontend → PR 3 base: api-endpoints ← top api-endpoints → PR 2 base: auth-layer auth-layer → PR 1 base: main ← bottom ───────────── main trunk The bottom of the stack is the branch closest to the trunk, and the top is the branch furthest from it. Each branch inherits from the one below it. Navigation commands up , down , top , bottom follow this model: up moves away from trunk, down moves toward it. When you submit, gh stack creates one PR per branch and links them together as a Stack on GitHub. Each PR's base is set to the branch below it in the stack, so reviewers see only the diff for that layer. Stack metadata is stored in .git/gh-stack a JSON file, not committed to the repo . This tracks which branches belong to which stack and their ordering. Rebase state during interrupted rebases is stored separately in .git/gh-stack-rebase-state . Initialize a new stack in the current repository. gh stack init flags branches... Initializes a new stack locally. In interactive mode no arguments , prompts for a branch name and offers to use the current branch as the first layer. When explicit branch names are given, existing branches are adopted automatically and any missing branches are created. The trunk defaults to the repository's default branch unless overridden with --base . Enables git rerere automatically so that conflict resolutions are remembered across rebases. | Flag | Description | |---|---| -b, --base