gh-stack

Coordinate stacked branches and pull requests with gh CLI.

11|2|Updated Jan 13, 2017
One-click install
npx skills add https://github.com/khaosdoctor/dotfiles --skill gh-stack-khaosdoctor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-stack
Source: https://github.com/khaosdoctor/dotfiles/tree/main/general/claude/.claude/skills/gh-stack
Command: npx skills add https://github.com/khaosdoctor/dotfiles --skill gh-stack-khaosdoctor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

gh-stack coordinates and streamline the management of stacked branches and their pull requests, enabling teams to break large changes into independently reviewable layers.

Core Features & Use Cases

  • Create, push, rebase, sync, and navigate stacked branches so reviewers see only the relevant diffs
  • View status, manage dependencies between PRs, and tear down/rebuild a stack to restructure work
  • Use it for workflows where a trunk is followed by multiple dependent feature branches, each with its own PR

Quick Start

Initialize a stack with gh stack init -p feat auth and then add subsequent layers with gh stack add to start building a multi-PR feature.

Frequently Asked Questions about gh-stack

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

FAQPage Schema
How do I manage stacked branches and dependent pull requests in GitHub?

Managing stacked branches and dependent pull requests involves coordinating multiple layers of feature branches so reviewers see only relevant incremental diffs. gh-stack streamlines this by syncing, rebasing, and navigating multi-PR workflows built on a trunk.

What is the best way to break large GitHub changes into independently reviewable PR layers?

Breaking large GitHub changes into independently reviewable layers requires stacking dependent feature branches. This approach lets reviewers focus on isolated diffs, and you can restructure the stack by tearing down and rebuilding branches as needed.

Do I need the gh CLI to coordinate stacked branches and pull request dependencies?

Yes, coordinating stacked branches requires gh CLI v2.0 or higher with the gh-stack extension installed. The workflow also enables git rerere to remember conflict resolutions across subsequent rebases of the stacked layers.

How do I start building a multi-PR feature stack with dependent branches?

Start building a multi-PR feature stack by initializing the first layer with a command like gh stack init, then add subsequent dependent layers using gh stack add to push and create linked pull requests for incremental reviews.

Why does rebasing a stacked branch cause conflicts in lower pull requests?

Rebasing a stacked branch causes conflicts in lower pull requests because dependent layers shift against the updated trunk. Enabling git rerere helps remember and automatically reapply previous conflict resolutions across these repeated stacked rebases.

Can I use gh-stack for non-interactive pull request workflows?

Yes, gh-stack enforces non-interactive usage to automate stacked branch coordination. This ensures reliable scripting and execution for pushing, syncing, and managing dependencies between multiple pull requests without manual intervention.