gh-stack

Manages stacked GitHub pull requests and splits multi-part work into reviewable branch layers.

Updated May 12, 2026
One-click install
npx skills add https://github.com/laionazeredo/che-ai --skill gh-stack-laionazeredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gh-stack
Source: https://github.com/laionazeredo/che-ai/tree/main/skills/gh-stack
Command: npx skills add https://github.com/laionazeredo/che-ai --skill gh-stack-laionazeredo

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 slow to merge. This Skill manages stacked PRs with the gh-stack GitHub CLI extension, splitting multi-part work into an ordered chain of small branches where each PR shows only its own layer's diff. ## Core Features & Use Cases - Stack lifecycle management: Create, view, edit, push, submit, sync, rebase, merge, and check out stacked branches with non-interactive commands safe for agent harnesses. - Layered branch design: Guidance on planning dependency-ordered layers (models, API, frontend, tests) so each PR is independently reviewable. - Recovery and troubleshooting: Documented exit codes and recovery paths for rebase conflicts, squash merges, diverged stacks, and locked state files. - Use Case: You are building a billing feature spanning schema, API, and UI. Create a stack with one branch per concern, submit draft PRs for each layer, and merge them bottom-up as reviews complete. ## 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, then submit them as draft pull requests.

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 layer's changes on its branch 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 dependency-ordered layers before writing code, such as models, API, frontend, and tests. Create the stack first with gh stack init, commit each concern on its own branch, and submit the stack so reviewers see only each layer's diff.

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

Yes, but you must pass explicit flags because gh stack branches on whether stdout is a TTY. Use view --json, submit --auto, merge with --yes, and always provide branch names to init and add to avoid prompts or TUIs.

What happens when a stacked PR is squash merged?▼

gh stack sync detects the squash merge and rebases remaining branches with --onto against the correct target, skipping the merged branch. No manual action is needed unless the replay conflicts, in which case run gh stack rebase and resolve.

Why does gh stack sync report Sync aborted without changing anything?▼

This means the local stack and the GitHub stack have diverged, and non-interactive sync refuses to guess. Either keep the remote version with unstack --local then checkout, or keep the local version with unstack then submit --auto.

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

Stacks are strictly linear with one parent and at most one child, and there is no non-interactive reorder or removal since gh stack modify is TUI-only. Restructuring requires unstack followed by init, and gh pr merge cannot merge a stack.