Sync the current Graphite stack with trunk (fetch + rebase) and resolve any merge conflicts that arise.
Steps
Phase 1: Pre-flight
- •Run
gt lsto show the current stack state - •Run
git statusto 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 syncreports conflicts:- •Run
git statusto 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 continueto resume the rebase - •If new conflicts appear, repeat this step
- •Run
- •Run
gt lsto confirm the stack is clean after sync
Phase 4: Summary
- •Show
gt log shortfor 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
gtis not installed, suggest:brew install withgraphite/tap/graphite