Expand description
Stack metadata: the branch.<name>.stkParent/stkBase annotations and
the structural queries built on them. Navigation lives in [nav], the
rebase engine in restack.
Enums§
- NavOutput
- How a navigation command reports where it landed.
Functions§
- abort_
restack - adopt_
branch - apply_
remote_ metadata - Rebuild local stack metadata from the shared ref, fetching any listed branch that is not present locally. Returns how many branches it attached.
- behind_
parent_ hint - A restack nudge when
branchis missing commits from its parent’s tip. Local-only; a missing parent yields nothing. - branch_
and_ descendants - branch_
parents - (branch, parent) pairs for the branches that stack on something. A branch with no recorded parent is skipped, and so is a floor - it is the base the stack sits on, whatever parent it may have picked up, and callers use this to decide what to write to (review bodies, the metadata ref).
- checkout_
bottom - Check out the bottom of the current stack: the branch just above the trunk. From the trunk itself, a single stacked child is unambiguous.
- checkout_
child - Walk
distancebranches up, towards the leaf, prompting at each fork the waytopdoes.up <branch>names a child instead and always moves one. - checkout_
parent - Walk
distancebranches down, towards the trunk. - checkout_
top - Check out the leaf of the current stack, following single children. A
fork is ambiguous, like
upwithout a branch. - clear_
floor - clear_
renamed_ from - Drop the rename marker once its review has been handled.
- continue_
restack - create_
branch - create_
branch_ in_ worktree - Create
branchin a new worktree of its own instead of checking it out here, leaving the current worktree on the branch it was already on. - current_
stack_ branches - Every branch in the stack
branchbelongs to, trunk excluded: the whole subtree under the stack’s base (so fork siblings are included too), unlikestack_linewhich is onlybranch’s own line. The base is the bottom ofbranch’s line - its topmost non-trunk ancestor - so sibling stacks that merely share the trunk are left out, exactly as they are forstack_line. For an unanchored stack the base is its real root branch, itself stacked, so it stays in. - detach_
branch - insert_
branch - Insert a new empty branch directly above the current one, moving the
current branch’s children onto it. The new branch shares the current tip,
so descendants stay correctly based; commit to it, then
restackto replay them. Any uncommitted changes ride onto the new branch, likenew. - is_
floor - Whether
branchis a stack floor - see [FLOOR_KEY]. - listed_
branches - The branches
listmay annotate with review info: the current stack, or - withall- every stacked branch. A superset of what the tree actually draws is fine here; its only job is to bound which branches get a per-branch review lookup, solistnever queries every open PR in the repo. - mark_
floor - Record
branchas a stack floor. Best effort: a floor that fails to record is still derived from the shape while branches sit on it, so a failure here costs persistence, not protection. - owned_
worktree - The worktree git-stk created for
branch, if it created one and it is still there. Only these are ours to remove. - path_
from_ root - The stack path from the bottom up to (and including)
branch, parent-first; descendants above it are left out. - prepend_
branch - Insert a new empty branch directly below the current one, moving the
current branch onto it. Branches from the current branch’s parent, so it
requires a clean worktree. Commit to it, then
restack. - print_
all_ stacks - Print every stack, not just the current one, each as its own block separated by a blank line. Stacks that merely share the trunk are drawn separately - one per direct trunk child - each repeating the trunk as its base, so they read as distinct piles rather than one tangled tree. Rootless fragments print above the trunk-anchored ones. The branch you are on is marked wherever it appears.
- print_
children - print_
parent - print_
stack - publish_
metadata - Publish the current stack’s parent map to the shared metadata ref so another clone can rebuild it. Best effort: a failure warns but never aborts the push that triggered it.
- record_
base - Record the fork point between a branch and its parent (best effort; e.g. unrelated histories have no merge base, which is not an error here).
- recorded_
worktree - What the marker says, whether or not the directory still exists.
repairneeds the raw value to spot a marker pointing at nothing. - rename_
branch - Rename a branch and keep the stack intact. Git moves the branch’s own metadata with the rename; children pointing at the old name are retargeted here.
- renamed_
from - The branch
branchwas renamed from, if a replaced review is still pending. - restack
- set_
owned_ worktree - Record that git-stk owns
branch’s worktree atpath. - set_
renamed_ from - Record that
branchis the rename ofold, whose open review the next submit should replace and close. - snapshot
- Record the current stack so
undocan restore it. Thelabelnames the operation being undone. No-ops after the first call in a process, and is best effort: a snapshot failure never blocks the command itself. - stack_
line - Every branch in the stack containing
branch, parent-first: the line from the stack bottom up throughbranch, plus everything above it. Sibling stacks that share only the trunk are left out - they branch off the trunk separately, not throughbranch. The trunk itself is excluded; an unanchored root stays in (path_from_rootkeeps it). - stack_
root - The root of the stack containing
branch(the base everything sits on). - stacked_
layers - The branches in
linethat actually stack on something - those with a recorded parent. A line rooted off the trunk keeps its parentless root (seepath_from_root), and that root is the base the branch above it targets, not a layer of the stack: nothing submits, pushes, or merges it.restackandabsorbalready skip it; this is how the rest agree. - trunk_
branch - The trunk branch: the remote’s default branch when known locally, otherwise a conventional name that exists.
- trunk_
held_ elsewhere - Whether the trunk cannot be fetched because another worktree has it checked out, reporting the skip when so.
- unanchored_
base - The base
branchessits on, when that is a branch rather than the trunk: the parentless root of a line rooted off-trunk, with layers stacked on it. It is not part of the stack - nothing submits, pushes, merges, or re-parents it - so callers hold it out of whatever they are about to do. - undo
- Restore the most recent snapshot: reset branch tips and metadata to their pre-mutation state. Refuses on a dirty worktree (it resets the current branch) and consumes the snapshot so it is one-shot.
- unset_
owned_ worktree - Forget that git-stk owns a worktree for
branch.