| name | gt-sync |
| description | Sync the Graphite stack with trunk and resolve any rebase conflicts |
| disable-model-invocation | true |
| argument-hint | |
Sync the current Graphite stack with trunk (fetch + rebase) and resolve any merge conflicts that arise.
Steps
Phase 1: Pre-flight
- Run
gt ls to show the current stack state
- Run
git status to ensure the working tree is clean
- If dirty, warn the user and suggest stashing or committing first
- Do NOT proceed with a dirty working tree
Phase 2: Sync
- Run
gt sync
- Check the exit code and output for conflicts
Phase 3: Resolve conflicts (if any)
- If
gt sync reports conflicts:
- Run
git status to identify conflicted files
- For each conflicted file:
- Read the file to understand both sides of the conflict
- Resolve the conflict by choosing the correct resolution
- Stage the resolved file with
git add <file>
- Run
gt continue to resume the rebase
- If new conflicts appear, repeat this step
- Run
gt ls to confirm the stack is clean after sync
Phase 4: Summary
- Show
gt log short for the final stack state
- Report which branches were updated and any conflicts that were resolved
Rules
- NEVER proceed with a dirty working tree โ warn and stop
- NEVER discard changes during conflict resolution without asking the user
- ALWAYS show the conflicted hunks to the user before resolving
- ALWAYS prefer the intent of the local (stack) changes unless the user says otherwise
- If a conflict is ambiguous or involves logic changes on both sides, ask the user how to resolve it
- If
gt is not installed, suggest: brew install withgraphite/tap/graphite