gh-stack
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
Skill by github
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sreejithraman-gh-stack
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
gh-stack- Description
- Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack. Use for stack creation, viewing, edits, push, submit, sync, rebase, merge, or checkout; when asked to split or isolate work for review; whenever a user mentions a stack, branch layers, dependent PRs, or gh stack; or when a stack is checked out.
- License
- MIT
- Metadata
- author: github · version: 0.2.0
- Instructions
- 195 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- commands.md · references/
- stack-design.md · references/
- troubleshooting.md · references/
SKILL.md (first lines)
# gh-stack `gh stack` is a [GitHub CLI](https://cli.github.com/) extension for stacked branches and pull requests. A stack is an ordered chain of branches rooted on a trunk, where each branch has one PR based on the branch below it, so a reviewer sees only that layer's diff. `gh stack` prints a stack trunk-first, left to right: ``` (main) <- auth <- api <- frontend ``` Left is the **bottom**, right is the **top**. `auth` is based on `main` and merges first; `frontend` merges last. `up` moves toward the top, away from trunk; `down` moves toward it. Foundational work belongs at the bottom, code that depends on it above. For how to choose the layers, read `references/stack-design.md`. For PRs created or worked on in T3 Code, apply [thread registration](../pr/SKILL.md#thread-registration)'s thread registration rules to every scoped layer. Stack CLI operations alone do not register PRs with the thread. ## Setup Requires Git 2.36+ and an authenticated GitHub CLI. Before relying on worktree-aware behavior, inspect `gh stack --version` and the installed command's `--help`, including support for `--print-path`. Older extensions may lack the shared catalog and owner-aware recovery described here. Upgrade only within the task's authorization. ```bash gh extension install github/gh-stack git config rerere.enabled true # remember conflict resolutions git config remote.pushDefault origin # required if the repo has more than one remote ``` ## Non-interactive use `gh stack` branches on whether **stdout is a TTY**. Piped, most commands error cleanly or print static text; under a PTY the same commands open a prompt or a full-screen TUI and block forever. Agent harnesses differ, so always pass the flags below instead of relying on that detection. **Multiple remotes:** never run `push`, `submit`, `sync`, `rebase`, or `link` without `--remote <name>` unless `remote.pushDefault` is configured. `checkout` and `trunk` have no `--remote` flag and require the config. | Always run | Never run bare | Why | |---|---|---| | `gh stack view --json` | `gh stack view` | opens a TUI under a PTY | | `gh stack submit --auto` | `gh stack submit` | prompts for a title per new PR | | `gh stack merge <target> --yes` | `gh pr merge` | `gh pr merge` cannot merge a stack | | `gh stack init <branch>...` | `gh stack init` | prompts for branch names | | `gh stack add <branch>` | `gh stack add` | prompts for a name, and fails even when piped | | `gh stack checkout <target>` | `gh stack checkout` | opens a selection menu | | `gh stack up` / `down` / `top` / `bottom` | `gh stack switch` | `switch` is menu-only | | — | `gh stack modify` | TUI-only, no non-interactive path | - `view --short` is safe in both modes, but it is formatted for humans. Use `--json` to parse. - **`checkout <pr>` when a different local stack already covers those branches** cannot be forced. Run `gh stack unstack --local` first (this keeps the stack on GitHub), then retry. - **Worktrees:** local stacks share one common-directory catalog. Use `--print-path` with navigation or explicit-target `checkout` to locate a foreign-owned branch without stealing its checkout. Unoccupied targets are checked out here first. Check the exit status before changing directories; parse only successful path-mode stdout, never status messages. ## Branch placement - **Starting multi-part work:** create the stack before writing files. Do not implement every concern on trunk and split it later. Put one dependent concern in each layer, bottom to top. - **Editing an existing stack:** check out the layer that owns the change before editing. Never commit a lower layer's concern on the current top branch. Run `gh stack view --json`; if ownership is unclear, inspect `git log --all -- <path>`. Then check out the owner, edit, commit, rebase upstack, and return to top. ```bash gh stack down # or: gh stack checkout api git add ... && git commit -m "Add get-user endpoint" gh stack rebase --upstack # replay every branch above onto the change gh stack top # return to where you were gh stack push ``` ## Core loop ```bash gh stack init auth # create the stack and check out its branch git add ... && git commit -m "Add auth middleware" gh stack add api # next layer, branched from the current one git add ... && git commit -m "Add API routes" gh stack submit --auto # push every branch and open draft PRs gh stack view --json # confirm ``` Add `--open` to `submit` to create PRs ready for review instead of drafts. Branch names are verbatim — `gh stack add refactor/foo` creates `refactor/foo`. ## Staying in sync ```bash gh stack sync # fetch, reconcile with GitHub, rebase, push, refresh PR state gh stack sync --prune # also delete local branches for merged PRs ``` Pruning never happens without `--prune` when non-interactive. If the local and remote stacks have diverged, `sync` prints both chains, makes no changes, and exits 0 with `Sync aborted` — see `references/troubleshooting.md`. ## Merging Scope the merge with an argument: ```bash gh stack merge 42 --yes # PR #42 plus every unmerged PR below it gh stack merge 7 --yes # every unmerged PR in stack #7 gh stack merge 42 --yes --squash # or --merge, --rebase, --merge-method <method> ``` Pass a PR number to merge that PR and every unmerged PR below it, or a stack number to merge every unmerged PR in that stack. The operation is all-or-nothing: if any PR in that set cannot merge, none do.
From sreejithraman/SreeStack, MIT.
More from sreejithraman/SreeStack
- 0.592score
agent-login
sreejithraman
Use when signing into applications, setting up or diagnosing agent credential access, or supplying and managing approved credentials for authentication.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
app-intents
sreejithraman
App Intents work on Apple platforms.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
app-store-connect
sreejithraman
Use when asked to check App Store Connect builds, investigate TestFlight crashes or feedback, distribute betas, prepare or submit a release, fix App Review…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
engineering-principles
sreejithraman
Guide engineering design and implementation decisions.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
architect
sreejithraman
Sketch caller usage, types, signatures, and module structure, then stay in the loop while implementation fills in.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
animate
sreejithraman
Design, implement, and tune web, SwiftUI, and UIKit interface motion.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
correct
sreejithraman
Investigate and prevent recurring agent mistakes in a repository.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
goal-swarm
sreejithraman
Pursue an explicitly requested goal or swarm through its finish line.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
arena
sreejithraman
Produce independent candidates for one artifact, pick a base, and graft the strongest parts into one verified result.
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gauntlet-loop
sreejithraman
Turn a goal into a short, paste-ready prompt for a builder-and-critic loop against a real quality bar.
SkillAFreshness: A★ 1Claude Code +9 - 0.579score
change-safety
sreejithraman
Assess a code change's blast radius beyond its diff.
SkillAFreshness: A★ 1Claude Code +9 - 0.579score
code-why
sreejithraman
Investigate code history to explain a design decision's rationale, when and why a regression was introduced, or whether an old constraint still applies.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 13, 2026 (16 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.2.0
- License
- MIT
- Repository
- github.com/sreejithraman/SreeStack
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.641score
gh-stack
github
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: A★ 13Claude Code +9 - 0.377score
gh-stack
github
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: A★ 9Claude Code +9 - 0.358score
gh-stack
github
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: A★ 2Claude Code +9 - 0.352score
gh-stack
github
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: A★ 1Claude Code +9 - 0.342score
gh-stack
pascalandy
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: AClaude Code +9
More from github
- 0.860score
GitHub
githubOfficial
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
ConnectorAFreshness: ARemoteLocal★ 33.9KClaude Code +5 - 0.749score
AGENTS.md · github/spec-kit
github
AGENTS.md from github/spec-kit: 77 lines covering About Spec Kit and Specify, Adding or Updating CLI Commands, Adding or Updating MCP Commands, Adding or…
TemplateAFreshness: A★ 142.7KCodex +5 - 0.641score
gh-stack
github
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
SkillAFreshness: A★ 13Claude Code +9 - 0.523score
gh-stack
github
Create, inspect, or update stacks of dependent branches and PRs with the gh-stack CLI extension.
SkillBFreshness: BClaude Code +9 - 0.510score
gh-stack
github
Manage stacked branches and pull requests with the gh-stack GitHub CLI extension.
SkillBFreshness: BClaude Code +9
Cite this page
gh-stack skill. Agent Mart. https://agentmart.dev/skills/sreejithraman-gh-stack (last updated 2026-10-24)