Repolode
github

github/gh-stack

A GitHub CLI extension for creating, rebasing, submitting and merging stacked pull requests as a chain of small reviewable branches.

Stars
1,750
Forks
97
Open issues
158
Last commit
4 days ago

What is it?

gh-stack is a GitHub CLI extension for working with stacked pull requests, where a large change is split into a chain of small branches that each build on the one below. Each PR's base is set to the branch beneath it, so reviewers only see the diff for that layer.

The tool handles the routine work of a stack: creating branches, cascading rebases when a lower layer changes, pushing branches, creating one PR per layer and linking them as a Stack on GitHub. It also provides commands to navigate between layers, restructure a stack through a terminal UI (drop, fold, insert, reorder, rename), sync state after PRs are merged, and merge several stacked PRs in one all-or-nothing operation.

Stack metadata is kept locally in the Git common directory, so linked worktrees share the same catalog. Conflicts during rebase pause the operation and can be resumed or aborted with dedicated flags.

Key features

  • 01Create stacked branches and rebase the whole chain when a lower layer changes.
  • 02Submit one PR per branch with correct base branches, linked as a Stack on GitHub.
  • 03Restructure a stack in a terminal UI by dropping, folding, inserting, reordering or renaming branches.
  • 04Sync stack state with GitHub and prune branches after PRs merge.
  • 05Merge multiple stacked PRs up to a chosen PR in one operation.
  • 06Supports linked Git worktrees and includes JSON output for `gh stack view`.

Use cases

  • Splitting a large feature into small PRs that reviewers can approve one layer at a time.
  • Updating a middle layer of a stack after review feedback without manually rebasing each branch.
  • Merging a sequence of dependent PRs in order from the bottom of the stack.

Quick start

  1. 1

    Install the extension with GitHub CLI

    gh extension install github/gh-stack
  2. 2

    Start a new stack and check out the first branch

    gh stack init
  3. 3

    Add another branch on top of the stack

    gh stack add api-endpoints
  4. 4

    Open a stack of pull requests

    gh stack submit

In collections

Topics

FAQ

What is gh-stack?
A GitHub CLI extension for creating, rebasing, submitting and merging stacked pull requests as a chain of small reviewable branches. gh-stack is a GitHub CLI extension for working with stacked pull requests, where a large change is split into a chain of small branches that each build on the one below. Each PR's base is set to the branch beneath it, so reviewers only see the diff for that layer.
Is gh-stack free to use? What license does it have?
gh-stack is open source under the MIT license. Check the license terms before using it in commercial products.
Is gh-stack still maintained?
Actively maintained. The last commit to gh-stack was on Nov 3, 2026.
What can I use gh-stack for?
Splitting a large feature into small PRs that reviewers can approve one layer at a time. Updating a middle layer of a stack after review feedback without manually rebasing each branch. Merging a sequence of dependent PRs in order from the bottom of the stack.
How do I install gh-stack?
Install the extension with GitHub CLI: gh extension install github/gh-stack Start a new stack and check out the first branch: gh stack init Add another branch on top of the stack: gh stack add api-endpoints Open a stack of pull requests: gh stack submit
Where can I get gh-stack?
The source code and installation instructions are on GitHub: https://github.com/github/gh-stack

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects