gh-stack

Coordinate GitHub stacked branches and PRs via gh CLI.

1|Updated Apr 5, 2026
One-click install
npx skills add https://github.com/mortenbroesby/playground --skill gh-stack-mortenbroesby
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-stack
Source: https://github.com/mortenbroesby/playground/tree/main/.skills/gh-stack
Command: npx skills add https://github.com/mortenbroesby/playground --skill gh-stack-mortenbroesby

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinate GitHub stacked branches and PRs to simplify multi-PR feature workflows and reviews.

Core Features & Use Cases

  • Create and manage a stack of branches where each PR is based on the one below it, enabling staged code reviews.
  • View, rebase, sync, push, and submit stacked PRs to keep trunk stable while iterating on dependent changes.
  • Navigate between layers and rely on GitHub stacking to automatically link PRs and maintain a coherent chain.

Quick Start

Initialize a new stack with gh stack init, add further layers with gh stack add, and push or submit to create PRs.

Frequently Asked Questions about gh-stack

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

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

Managing dependent pull request chains involves orchestrating stacked branches where each PR bases on the one below it. This Skill coordinates GitHub stacked PRs across init, add, push, submit, sync, rebase, and view operations to simplify multi-PR feature development and staged code reviews.

What is the best way to rebase a stack of pull requests without breaking the chain?

Rebasing a stack of pull requests requires syncing each dependent branch to maintain a coherent PR chain. You can use the rebase and sync operations to update stacked branches, ensuring trunk stays stable while iterating on linked dependent changes without breaking the base relationships.

Do I need the GitHub CLI to automate stacked PR workflows non-interactively?

Yes, automating stacked PR workflows non-interactively requires the GitHub CLI v2 or higher. The Skill relies on the gh CLI to validate stack structure, link PRs, maintain trunk and base relationships, and expose structured stack data via the --json flag for agent workflows.

Can I view and validate the structure of my stacked branches before pushing?

Viewing and validating stacked branch structure is supported through the view operation. It validates PR linking, trunk, and base relationships while exposing stack data via the --json flag, allowing you to inspect the dependent PR chain before executing push or submit actions.

How do I start building a stacked PR workflow from an existing trunk branch?

To start building a stacked PR workflow, initialize a new stack on a trunk branch using the init operation, add further dependent layers with add, and then use push or submit to create the linked pull requests on GitHub automatically.

When should I not use stacked branches for multi-PR feature development?

You should avoid stacked branches when your feature changes are independent rather than dependent, or when your review process cannot accommodate staged PR chains. Stacked PRs work best for iterative, layered changes where each branch bases on the one below it for coherent code reviews.