Restack
Rebase Graphite stack onto updated parents and resolve any merge conflicts.
Steps
Restack:
gt restack 2>&1If clean: report which branches were restacked. Done.
If conflicts: loop until resolved — a. Read each conflicted file in full before editing b. Identify all conflict markers (
<<<<<<<,=======,>>>>>>>) in the file c. Resolve every conflict region in a single edit — never leave partial markers d.git add <file>each resolved file e.gt continue 2>&1f. If new conflicts appear (next branch in stack), repeat from (a)Report: list branches restacked, conflicts resolved, any issues.
Conflict Resolution Rules
- Read the full file first. Count all
<<<<<<<markers. Resolve all of them in one pass. - Take the semantically correct merge: understand what both sides changed, combine intent.
- For renames/refactors: apply the rename to the newer code from the child branch.
- After editing, verify no conflict markers remain:
rg -c '<<<<<<<' <file>beforegit add. - If a conflict is ambiguous and you can't determine the right resolution,
gt abortand report to the user.