sm up / down / top / bottom
Walk the stack relative to the current branch. Four small commands for the four directions.
Synopses
sm up [--first]
sm down [--first]
sm top [--first]
sm bottom [--first]| Command | Direction |
|---|---|
sm up | Move HEAD to the first child of the current branch. |
sm down | Move HEAD to the parent of the current branch. |
sm top | Walk up to a leaf of the current sub-stack. |
sm bottom | Walk down to the branch sitting directly on trunk. |
The --first flag
When the walk hits a fork (a branch with multiple children), the directional commands error out by default:
multiple children — pass --first or use `sm checkout` to choose--first resolves the fork by taking the alphabetically first branch. Pass it when you don't care which fork:
sm top --firstExamples
main
└── feat/api
├── feat/api-tests
└── feat/api-docsFrom feat/api, walking up hits the fork. Bare sm up errors:
sm up--first takes the alphabetically-first child (feat/api-docs):
sm up --firstOr pick the other fork explicitly:
sm checkout feat/api-testsFrom feat/api-tests, walk one step down to the parent:
sm downOr jump to the branch sitting directly on trunk (here that's feat/api again):
sm bottomTo get all the way to trunk itself, do bottom then one more down:
sm bottom
sm downWhat it does
For each direction, looks up the relationship in sm's metadata, runs git switch, and prints the new branch.
See also
sm checkout— direct switch or interactive picker.sm log— see where you are in the tree.
