Manage git stacks using Staccato (st) — create stacked branches, restack after changes, sync with remote, and create stacked PRs. Use when working in a repo with stacked branches, when the user mentions stacks/stacking, when you need to split work into incremental PRs, when you see `.git/stack/` or `refs/staccato/` in a repo, or when MCP tools prefixed with `st_` are available. Also use when the user says "st", "staccato", "stack", "restack", or "stacked PRs".
Staccato (st) manages dependent branch chains ("stacks") so each PR is small and focused. Branches form a tree rooted at trunk (main/master), and restacking rebases each branch onto its parent automatically.
When the staccato MCP server is connected, use these tools directly:
Read-only (structured JSON output):
st_log — stack tree structurest_status — stack tree with PR status (number, state, checks, reviews)st_current — current branch name, parent, whether in stackst_git_log — git log (params: range, limit, stat)st_git_diff — diff output (params: staged, paths)st_git_diff_stat — diff stat against a refst_git_status — working tree status (porcelain)Branch creation:
st_new — create branch from trunk (branch_name)st_append — create child of current branch (branch_name)st_insert — insert before current, reparent downstream (branch_name)Stack operations:
st_restack — rebase lineage onto parents (to_current: bool)st_continue — resume after conflict resolutionst_attach — add existing branch to stack (branch_name, parent)st_sync — fetch + detect merges + restack + push (dry_run, down_only)st_pr — push and get PR creation info (stack: push whole lineage)Git operations:
st_git_add — stage files (paths: string array)st_git_commit — commit (message)st_git_checkout — checkout branch (branch)st_git_cherry_pick — cherry-pick commits (commits: string array)st_git_reset — reset HEAD (mode: soft/mixed/hard, ref)Escape hatch:
st_run — run any st subcommand as a string (e.g. st_run(command: "up"), st_run(command: "delete feature-x --force"))Run st commands via shell:
st new <name> st append <name> st insert <name>
st up / down / top / bottom st switch (TUI)
st restack [--to-current] st continue / st abort
st modify [--all] [-m "msg"] st move --onto <parent>
st attach <branch> --parent <parent> st detach <branch>
st delete <branch> [-f] st log / st status
st sync [--dry-run] [--down] st pr make [--web]
st backup st restore [branch] [--all]
st graph share / local / which
st new feature/api # branch from trunk
# ... write code, commit ...
st append feature/frontend # stack on top of current
# ... write code, commit ...
st append feature/tests # keep stacking
st down # or: st_git_checkout / st_run(command: "down")
# ... make changes, commit ...
st restack # rebase everything downstream
# make changes on the target branch
st modify --all # amends HEAD, auto-restacks downstream
# or with MCP: st_run(command: "modify --all -m 'updated msg'")
When st_restack or st restack reports a conflict:
st_git_status or git statusst_git_add(paths: ["file.go"]) or git add file.gost_continue or st continuest_run(command: "abort") or st abort to cancel and restore backupsst_sync # fetch, detect merged PRs, restack, push all
st_sync(dry_run: true) # preview what would happen
st_sync(down_only: true) # pull only, don't push
st_pr(stack: true) # pushes all branches in lineage, returns base/head pairs
# Then create PRs using gh or the forge — each PR targets its parent branch as base
st_attach(branch_name: "old-feature", parent: "main")
# or: st attach old-feature --parent main
st_run(command: "up") # go to child
st_run(command: "down") # go to parent
st_run(command: "top") # go to tip
st_run(command: "bottom") # go to first branch above root
git add, then st continue. The rest of the lineage restacks automatically after continuing.st restore recovers if things go wrong.git/stack/graph.json (local). Use st graph share to store in a git ref for team collaboration.