A terminal UI for GitHub that lets you browse, review and act on PRs and issues without leaving the command line.
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
Install the extension with GitHub CLI
gh extension install github/gh-stack - 2
Start a new stack and check out the first branch
gh stack init - 3
Add another branch on top of the stack
gh stack add api-endpoints - 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
A desktop Git client from GitHub that lets you manage repositories, branches, and commits through a graphical interface instead of the command line.
A VS Code extension that adds Git blame annotations, CodeLens, a Commit Graph, and tools for reviewing, rebasing, and managing branches and worktrees.
A beginner-oriented step-by-step tutorial that walks new contributors through forking, cloning, branching, committing and opening their first pull request.
A simple terminal UI for git commands that makes staging, committing, rebasing and branch work faster from the keyboard.
Git is a fast, distributed revision control system with a rich command set that exposes both high-level operations and low-level internals.