/murnana-github:stack-rebase [--upstack | --downstack | --no-trunk | sync]from murnana-github
Cascade-rebase a GitHub stack with gh stack rebase / sync, resolve conflicts, and push
Ships in murnana-github. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Restore a linear history across a GitHub stack — every branch containing the tip of the layer below it — with gh stack rebase (or gh stack sync), resolve any conflicts, and push.
Run these first, each as its own Bash call, exactly as written:
git status --short --branch
gh stack view --json
Treat $ARGUMENTS as the requested mode (--upstack, --downstack, --no-trunk, or sync). With no argument, choose per Step 2.
gh stack rebase / gh stack sync move branches, and only gh stack push / sync push them. Never run git rebase, git rebase --continue, git push --force, or git push on stack branches yourself: gh-stack keeps its own journal and per-branch metadata, and bypassing it desyncs the stack (wrong --onto after merges, broken --abort).gh stack modify or gh stack switch — TUI-only, they block this session.Copy this checklist into your response and tick it off:
- [ ] 1 Preconditions
- [ ] 2 Choose mode
- [ ] 3 Rebase (conflict loop)
- [ ] 4 Verify
- [ ] 5 Approval → push
AskUserQuestion tool, never as a plain-text question at the end of a reply. This includes every "wait for approval" and every "ask how to proceed": show the plan or the failure in the reply, then call AskUserQuestion with options such as 「この内容で進める」 and 「修正する」. The dialog can hide the reply, so say in the question itself, in one line, what is being approved.$ARGUMENTS, the conversation, the files or command output already answer. Where a step gives a default, use it and state it in the plan instead of asking.AskUserQuestion is unavailable (a non-interactive run), don't guess: stop before changing anything and list the questions in the reply.gh stack view --json failed with exit 2 → the current branch isn't in a stack. Stop and say so (/murnana-github:stack-create builds one).rebase and sync never stash. Ask the user to commit (to the layer that owns the change) or stash, then re-run.gh stack rebase --continue (go to Step 3's loop) or gh stack rebase --abort.modify session was interrupted. The user must run gh stack modify --abort themselves; stop.needsRebase: true and which are isMerged.| Situation | Command |
|---|---|
| User asked, or trunk moved and/or several layers need rebase (default) | gh stack rebase |
| A mid-stack layer just got new commits; only layers above it are stale | check out that layer, gh stack rebase --upstack |
| Only want trunk → current branch updated | gh stack rebase --downstack |
| Re-chain layers onto each other without pulling trunk | gh stack rebase --no-trunk |
| Lower PRs were merged on GitHub, or the remote stack changed (PRs added on the web) | gh stack sync — it fetches, reconciles, rebases, pushes, and refreshes PR state |
sync pushes as part of its run, so ask for approval (Step 5) before running it, not after. Add --prune (delete local branches of merged PRs) only if the user asked for it.
With multiple remotes and no remote.pushDefault, add --remote <name> to rebase/push/sync.
Run the chosen command. On exit 0, go to Step 4. On exit 3 (conflict):
git status --short confirms them.AskUserQuestion with the concrete options. Don't guess.git add <resolved files>, then gh stack rebase --continue.rerere (enabled by gh stack init) replays a resolution you already made when the same conflict reappears higher up the stack.gh stack rebase --abort restores every branch to its pre-rebase state.If sync hit the conflict, it has already restored all branches. Run gh stack rebase to reproduce the conflict, then use this loop.
Details per exit code and resolution principles: references/conflict-resolution.md.
gh stack view --json: every unmerged branch must have needsRebase: false. If not, report which and why before going further.gh stack push. It uses per-branch --force-with-lease and is not atomic: if one branch is rejected (someone pushed to it), the others still update. Report the rejected branch; usually gh stack sync reconciles it, then push again.gh stack down/checkout <branch>, commit, gh stack rebase --upstack) — never patch around it on an upper branch to avoid a rebase.rebase and sync also update clean linked worktrees, and block if an affected worktree is dirty or busy. Report the blocking worktree path rather than touching it.--continue / --abort act on the worktree recorded in gh-stack's journal, not necessarily the current one.sync, not rebase, to pick that up locally.--continue/--abort semantics, rerere, resolution principles:
references/conflict-resolution.mdWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub murnana/murnana-claude-code-plugin --plugin murnana-github5 skills in this plugin
/stack-pr-messageWrite titles and bodies for every PR in a GitHub stack and apply them with gh pr editOther plugins' skills for the same job