gh-stack

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

3|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/MaxWolf-01/agents --skill gh-stack-maxwolf-01
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-stack
Source: https://github.com/MaxWolf-01/agents/tree/main/mx/skills/gh-stack
Command: npx skills add https://github.com/MaxWolf-01/agents --skill gh-stack-maxwolf-01

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Large features delivered as one giant pull request are hard to review, and dependent changes spread across branches are painful to keep in sync. This Skill manages stacked PRs with the gh-stack GitHub CLI extension, so each layer of work gets its own small, reviewable PR based on the branch below it. ## Core Features & Use Cases - Stack creation and editing: Initialize a stack of dependent branches, add layers, edit the correct layer, and rebase everything above it automatically. - Non-interactive automation: Provides the exact flags and commands (view --json, submit --auto, merge --yes) that work safely in agent harnesses without TTY prompts or TUIs. - Sync, merge, and recovery: Sync with GitHub, handle squash merges, resolve rebase conflicts via documented exit codes, and restructure stacks when requirements change. - Use Case: You are building a feature spanning models, API routes, and a frontend. Create a three-layer stack, commit each concern to its own branch, submit draft PRs for all layers at once, and merge them bottom-up when approved. ## Quick Start Ask the agent to split the current feature work into a stacked set of PRs using gh stack, with one branch per concern. ## Quick Start Tell the agent to create a gh-stack with separate branches for each layer of the feature and 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 branch names bottom to top. Commit each concern to its layer and run 'gh stack submit --auto' to push branches and open draft PRs.

How do I split a large feature into smaller reviewable PRs?

Plan the layers before writing code, then create the stack with 'gh stack init' and add one dependent concern per branch using 'gh stack add'. Each PR shows only its own layer's diff, making reviews manageable.

Can gh-stack run non-interactively in CI or agent environments?

Yes, but you must pass explicit flags since gh stack branches on TTY detection. Use 'view --json', 'submit --auto', 'merge --yes', and always provide branch names to init, add, and checkout to avoid prompts or TUIs.

What happens when a stacked PR is squash merged?

A squash merge replaces the branch's commits, but 'gh stack sync' detects this automatically and rebases remaining branches with --onto against the correct target. No manual action is needed unless a conflict occurs.

Why does gh stack sync report divergence and do nothing?

Divergence means local and GitHub stacks changed differently, so sync prints both chains and exits 0 with 'Sync aborted'. Resolve it by either unstacking locally and re-checking out the remote stack, or unstacking on GitHub and resubmitting local state.

What are the limitations of gh-stack for reordering branches?

There is no non-interactive reorder, rename, or removal; 'gh stack modify' is TUI-only. To restructure, run 'gh stack unstack', fix Git ancestry with rebases, then rebuild with 'gh stack init' and resubmit.