/gt-workflow:gt-sync [--no-delete | --force]from gt-workflow
Pull latest trunk, restack all tracked branches, and untrack branches whose PRs merged. Use when user says "sync with main", "rebase my stack", or "pull latest", after PRs merge, or when gt reports "needs restack". Not for deleting stale local-only branches — use the gt-cleanup skill.
Ships in gt-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One-command repo sync: pulls the latest from trunk, restacks your branches, and cleans up merged PRs.
gt reports "needs restack".gt-cleanup skill
instead.Optional arguments:
--no-delete — Skip deleting merged branches by passing --no-interactive
through to gt sync so it does not prompt for (or perform) deletions (gt sync has no --no-delete flag itself)--force — Restack even if the stack appears clean (still stopping at
conflicts for manual resolution) instead of skipping the restack step
(Phase 2 Step 3) when there are no divergence markers; gt sync itself
(Phase 2 Step 1) always runs regardlessThe argument text provided after the skill name (if any) is available as context for this invocation.
Record the starting point so we can report what changed:
echo "=== Current branch ==="
git branch --show-current
echo "=== Trunk branch ==="
gt trunk
gt log short
echo "=== Local branches ==="
git branch --list
Run Graphite repo sync to pull the latest trunk and identify merged branches.
If --no-delete was passed:
gt sync --no-interactive
Otherwise:
gt sync
If gt sync fails (network error, authentication issue, etc.), report the
error to the user and stop. Do not proceed to restacking with stale state.
This will:
--no-delete is not
passed)gt log short
Inspect the output for divergence markers. Graphite indicates a branch needs
restacking when it shows (needs restack) next to a branch name, or when a
branch is shown with ◯ instead of ◉ (indicating it is no longer based on its
parent's current tip). If none of these markers appear and --force was not
passed, skip to Phase 3; otherwise continue to the restacking step in Phase 2.
If branches need restacking (they've diverged from their parents after trunk moved):
gt stack restack
If the restack fails, check whether it's due to conflicts or another error:
If conflicts:
git add <resolved-files>
gt continue
git rebase --abort
If non-conflict failure (network, auth, corrupted state):
gt stack restackgit status and gt log short to diagnoseecho "=== Final stack ==="
gt log short
echo "=== Branches ==="
git branch --list
Output a report:
Sync Complete
─────────────
Trunk: <trunk branch> (updated to <short sha>)
Restacked: <yes/no/not needed>
Conflicts: <none / list of conflicted branches>
Cleaned up: <list of deleted merged branches, or "none">
Current: <current branch>
Stack:
<gt log short output>
--no-delete)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
11 skills in this plugin
/audit-reviewRun 1-3 parallel quick-audit passes (code quality, security, error handling) over a diff and gate on findings. Use when smart-submit or gt-amend need to audit uncommitted changes before committing./gt-amendFold working-tree changes into the current branch commit, audit them, and re-submit via Graphite. Use when user says "amend this", "add this to the current PR", "fold this fix in", or has follow-up edits for an already-submitted branch. Not for starting new work — use the smart-submit skill instead./gt-cleanupScan local branches for staleness and divergence, then delete or reconcile them with safeguards. Use when user says "clean up my branches" or "which branches are stale". For deleting branches whose PRs merged — and for pulling trunk or restacking — use the gt-sync skill./gt-mergeMerge the current stack's pull requests, from trunk up to the current branch, via Graphite. Use when the user says "merge my stack" or "land these PRs" and the stack is fully reviewed and ready./gt-navVisualize your Graphite stack and navigate between its branches. Use when user says "show my stack", "where am I in the stack", "go up/down a branch", or "checkout the top of the stack". Not for restacking, syncing, or cleanup — use the gt-sync or gt-cleanup skill./gt-setupValidate Graphite CLI prerequisites and configure settings for AI agent workflows. Use when first installing the plugin, after Graphite auth changes, or when gt commands fail.npx claudepluginhub kinginyellows/yellow-plugins --plugin gt-workflow