sm track
Adopt an existing branch into the stack graph.
Synopsis
sm track [branch] [--parent <branch>]If no branch is given, tracks the current branch.
Flags
| Flag | Description |
|---|---|
--parent <branch> | Explicit parent branch. Default: inferred from git merge-base. |
Examples
You created a branch with plain git switch -c and want sm to know about it:
bash
git switch -c feat/legacy-import
sm track --parent mainTrack the current branch with auto-detected parent:
bash
sm trackTrack a different branch by name:
bash
sm track feat/legacy-import --parent feat/api-v2What it does
- Resolves the parent (explicit
--parentwins; otherwisegit merge-baseagainst tracked branches and trunk picks the closest match). - Records
branch.<n>.stac-man-parentandbranch.<n>.stac-man-parent-sha. - Prints the resolved parent.
After tracking, the branch shows up in sm log, gets restacked by sm restack / sm sync, and is eligible for sm submit.
See also
sm untrack— the inverse.sm create— preferable togit switch -c+sm trackwhen you're starting fresh.sm doctor— surfaces untracked branches with unique commits.
