gh-stack

Manages stacked GitHub pull requests and splits multi-part work into reviewable branches with gh-stack.

4|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/staticaland/skills --skill gh-stack-staticaland
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gh-stack
Source: https://github.com/staticaland/skills/tree/main/plugins/pull-requests/skills/gh-stack
Command: npx skills add https://github.com/staticaland/skills --skill gh-stack-staticaland

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Large changes submitted as a single pull request are hard to review, and splitting work into dependent branches by hand means constant rebasing, retargeting PR bases, and tracking merge order. This Skill drives the gh-stack GitHub CLI extension so an agent can create, edit, sync, and merge an ordered chain of dependent PRs where each reviewer sees only one layer's diff. ## Core Features & Use Cases - Stack creation and layering: Initialize a stack with gh stack init, add layers bottom to top with gh stack add, and open draft or ready PRs for every branch with gh stack submit --auto. - Non-interactive operation: Explicit guidance on which commands and flags are safe in agent harnesses (e.g. view --json, submit --auto, merge --yes) and which TUI-only commands to avoid, plus a full exit-code table with recovery steps. - Sync, rebase, and merge workflows: Keep stacks current with gh stack sync, recover from rebase conflicts and squash merges, and merge a PR plus everything below it atomically with gh stack merge. - Use Case: You are building a feature spanning models, API routes, and a frontend. The Skill creates three stacked branches, commits each concern into its own layer, submits three chained draft PRs, and later rebases and merges them in order after review. ## Quick Start Ask the agent to split the current feature work into a stack of dependent pull requests using gh stack, with one branch per concern, then submit them as draft PRs.

Frequently Asked Questions about gh-stack

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create stacked pull requests on GitHub?▼

Install the gh-stack extension with `gh extension install github/gh-stack`, then run `gh stack init` with your branch names bottom to top. Commit each concern into its layer and run `gh stack submit --auto` to push every branch and open chained draft PRs.

How do I split a large pull request into smaller reviewable PRs?▼

Plan the layers before writing code, then create one branch per dependent concern using `gh stack init` and `gh stack add`. Each branch gets its own PR based on the branch below it, so reviewers see only that layer's diff.

Can gh stack commands run non-interactively in CI or an agent?▼

Yes, but you must pass explicit flags because behavior branches on whether stdout is a TTY. Use `view --json`, `submit --auto`, `merge --yes`, and always name branches for `init` and `add`; TUI-only commands like `modify` and `switch` have no non-interactive path.

What happens when a stacked PR is squash merged?▼

A squash merge replaces the branch's commits, but `gh stack sync` detects this and rebases the remaining branches with `--onto` against the correct target automatically. If the replay conflicts, sync restores all branches and exits 3 so you can resolve with `gh stack rebase`.

Why does gh stack merge fail when a merge queue is enabled?▼

A merge queue on the base branch overrides the merge: the stack is added to the queue instead of merged directly, and the queue chooses the method, ignoring any method flag. Queued PRs may land in separate groups as the queue processes them.

What are the limitations of stacked PRs with gh-stack?▼

Stacks are strictly linear with one parent and at most one child, so parallel work needs separate stacks. There is no non-interactive reorder or removal; restructuring requires `unstack` followed by `init`, and PR titles must be edited afterward with `gh pr edit`.