# Gh Stack

Manage Cherry Studio stacked branches and pull requests with the GitHub gh-stack...

- Repository: https://github.com/CherryHQ/cherry-studio (53164 stars)
- Category: Git and review
- License: AGPL-3.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add CherryHQ/cherry-studio --skill gh-stack -g -a claude-code -y`
Codex: `npx skills add CherryHQ/cherry-studio --skill gh-stack -g -a codex -y`
Cursor: `npx skills add CherryHQ/cherry-studio --skill gh-stack -g -a cursor -y`
Gemini CLI: `npx skills add CherryHQ/cherry-studio --skill gh-stack -g -a gemini-cli -y`

## Description

Manage Cherry Studio stacked branches and pull requests with the GitHub gh-stack extension. Use for planning, creating, inspecting, rebasing, syncing, linking, or recovering a stack of dependent PRs.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# GitHub Stack

Use `gh stack` for branch topology and synchronization. Use the repository's `gh-create-pr` skill for Cherry-specific PR bodies, Spec approval, AC coverage, verification, and Agent Note lifecycle.

## Availability and prerequisites

This public skill is tracked in `.agents/skills/` and discovered from the repository. Developers do not install a separate agent skill. `pnpm skills:sync` maintains the `.claude/skills/` compatibility symlink.

Run this preflight before the first `gh stack` command in a task:

```bash
command -v gh >/dev/null 2>&1 || {
  echo "GitHub CLI is required: https://cli.github.com/" >&2
  exit 1
}
gh auth status
if ! gh stack --help >/dev/null 2>&1; then
  gh extension install github/gh-stack
fi
gh stack --help >/dev/null
```

If GitHub CLI authentication, extension installation, or the final verification fails, stop and report the failing command. Do not guess stack topology with ad hoc branch comparisons.

Before initializing a stack, avoid extension prompts:

```bash
git config rerere.enabled true
```

When multiple remotes exist, resolve the intended remote and pass `--remote <name>` to commands that accept it. Do not silently change `remote.pushDefault` for the developer.

## Stack model

A stack is a linear dependency chain. The bottom branch is closest to the trunk; each higher branch contains only work that depends on the layer below it.

```text
main
  -> spec
    -> implementation-core
      -> implementation-ui
```

Plan the complete dependency order before creating branches. Put a newly discovered lower-layer change on its owning branch, then rebase the upstack branches; do not hide it in the current layer.

## Agent-safe commands

All commands must be non-interactive:

The rest: https://github.com/CherryHQ/cherry-studio/blob/HEAD/.agents/skills/gh-stack/SKILL.md
