gt stack: Inspect and Restack a Graphite Stack
gt commands like log, restack, and sync inspect and rebuild the stack of dependent branches Graphite tracks.
A Graphite stack is a chain of branches each based on the one below. gt log shows the stack, gt restack rebases it after edits, and gt sync pulls trunk and cleans merged branches.
What it does
gt tracks parent/child relationships between branches. gt log (or gt log short) prints the stack, gt restack rebases descendants onto their updated parents, and gt sync fetches trunk, restacks, and offers to delete branches whose PRs merged.
Common usage
# view the current stack
gt log short
# rebuild the stack after amending a lower branch
gt restack
# pull trunk and clean up merged branches non-interactively
gt sync --no-interactive --forceOptions
| Command / Flag | What it does |
|---|---|
| gt log / gt log short | Print the stack of tracked branches |
| gt restack | Rebase descendant branches onto updated parents |
| gt sync | Fetch trunk, restack, prune merged branches |
| --no-interactive | Do not prompt (fail instead) |
| --force | Skip confirmations (e.g. deleting merged branches) |
| gt track / gt untrack | Add or remove a branch from the stack |
In CI
gt sync --no-interactive --force is the scriptable form for updating a stack in automation. gt restack can leave you in a rebase conflict; check the exit code and abort with git rebase --abort if a job should not stop to resolve it.
Common errors in CI
"Could not find a Graphite repo" or "not a Graphite repo" means gt init has not run in this clone. "not authenticated" surfaces if a subcommand needs GitHub access. A restack that stops with "CONFLICT" leaves a rebase in progress; the job must resolve or abort it before continuing.