sm sync
Pull trunk, delete merged branches, restack survivors, retarget PR bases on GitHub.
Synopsis
sm syncNo flags.
Examples
Daily-cleanup pass:
bash
sm syncOutput (typical):
✓ pulled main
merged & deleted:
feat/db-schema
retargeted PR bases on GitHub:
#42 (feat/api-endpoints) → main
✓ stack is up to dateWhat it does, in order
- Fetch from origin.
- Fast-forward local trunk to
origin/<trunk>. - Detect merged branches — any tracked branch whose unique commits are now reachable from trunk.
- Re-parent children of merged branches onto the merged branch's parent (usually trunk).
- Delete merged branches locally.
- Restack survivors onto their (possibly new) parents.
- Retarget PR bases on GitHub for any branch whose parent changed.
See Concepts → Sync for the mental model.
On conflict
If restacking the survivors hits a conflict, sync pauses with a PausedError exactly like sm restack:
⚠ rebase paused on feat/handlersResolve, git add, then sm continue.
What sync does NOT do
- Push. If sync changed your local stack, run
sm submit--stackafter. - Touch trunk if it's diverged from origin (refuses with an error rather than risk a non-fast-forward).
See also
- Concepts → Sync — the full step-by-step.
sm land— merge the bottom-most PR and run sync as cleanup.sm restack— the local-only counterpart.
