Stacks
A stack is several branches in one worktree, each built on the one below. Each branch is a layer, built on the one below.
main
└─ schema
└─ api
└─ uiBuild
mia new schema --stack # a branch on top of this one, checked out here
mia new api --stack--worktree gives the new layer its own worktree. --in <worktree> adds to
another worktree's stack.
Move
mia up # the layer above
mia down # the layer below
mia stack go api # a layer by nameThese refuse when tracked files have uncommitted changes.
Look
mia stack # the layers, landed or not, and which needs a restack
mia stack name payments # name it; then mia switch payments
mia stack diff # this layer against the one belowKeep it in shape
mia stack restack # rebase every layer onto the one below
mia stack merge ui onto api # fold layers into a lower onemia never merges into your base branch.
Sync with the base
mia stack syncFetch the base's upstream, fast-forward the base when it is local, forget landed layers and restack the survivors. Current and base worktrees must be clean; a base that cannot fast-forward is left for you to reconcile.
Dropped layers' branches and worktrees stay. If the current layer landed,
mia moves to a surviving layer when one exists; if the whole stack landed,
the current branch stays where it is with no stack left. mia stack sync --json reports the base, current layer, dropped layers and rebase count.
Mia never pushes. For a repository with no upstream, use mia stack restack
without fetching.
Forget
mia stack rm # forget the stack; branches and worktrees stay
mia stack rm --worktrees --branches # remove those too--branches refuses a branch with work nowhere else; --force deletes it
anyway.