Skip to content
Latchkey

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

Terminal
# 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 --force

Options

Command / FlagWhat it does
gt log / gt log shortPrint the stack of tracked branches
gt restackRebase descendant branches onto updated parents
gt syncFetch trunk, restack, prune merged branches
--no-interactiveDo not prompt (fail instead)
--forceSkip confirmations (e.g. deleting merged branches)
gt track / gt untrackAdd 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.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →