Manage stacked branches and pull requests with the gh-stack GitHub CLI extension. Use when the user wants to create, push, rebase, sync, navigate, or view stacks of dependent PRs. Triggers on tasks involving stacked diffs, dependent pull requests, branch chains, or incremental code review workflows.
gh-stack is a GitHub CLI extension designed to manage stacked branches and pull requests. It helps developers break large changes into a sequence of smaller, dependent branches, where each branch builds on the one below it and maps to its own pull request. This approach makes code reviews more focused and manageable by allowing reviewers to evaluate only the changes introduced at a specific layer instead of reviewing a large monolithic diff. The skill is intended for workflows involving stacked diffs, dependent pull requests, branch chains, and incremental development.
The skill supports creating, pushing, rebasing, syncing, navigating, and viewing stacks of branches and pull requests. It provides a structured model with trunk, bottom, and top branches, enabling users to move through stack layers and manage dependencies between changes. The documentation emphasizes non-interactive operation, requiring explicit arguments and flags to prevent prompts, interactive menus, or terminal user interfaces. It also includes guidance for configuring Git and GitHub CLI, planning stack dependencies, handling remotes, and using standard Git commands for staging and committing changes.
This skill is useful for developers and teams that rely on incremental code review workflows and need to organize complex features into reviewable units. It is particularly valuable when implementing foundational changes that support higher-level features, allowing each layer to be reviewed independently. Teams using GitHub-based development processes can use it to maintain cleaner pull request histories and improve collaboration during code review.
A stack is an ordered sequence of branches where each branch is based on the branch below it, starting from a trunk branch. Each branch corresponds to a pull request whose base is the branch directly below it.
You need GitHub CLI version 2.0 or later installed and authenticated, and the gh-stack extension must be installed. Git configuration is also recommended to avoid interactive prompts.
No. The documented workflow requires all gh-stack commands to be run non-interactively by providing the necessary arguments and flags to avoid prompts, TUIs, and menus.
gh-stack helps split large changes into smaller, dependent pull requests that are easier to review, understand, and manage.
Yes. Branches should not be shared across multiple stacks because commands can fail when a branch belongs to more than one stack. Dependency order should also be planned before creating the stack.
Quick Setup:
.claude/skills/Repository
github/gh-stack