Skip to main content
Four commands for moving through the branch stack by position rather than by name.

Commands

gx up

Moves to the child branch. If the current branch has exactly one child, switches to it:
If there are multiple children (a fork in the stack), gx lists them and asks you to use gx switch:
If already at the top:

gx down

Moves to the parent branch:
When reaching trunk:
If the branch is not in the stack:

gx top

Jumps to the leaf of the stack (the topmost branch with no children):
If the stack forks, gx cannot determine a single top:

gx bottom

Jumps to the first branch in the stack (the one directly above trunk):
When run from trunk, enters the stack:
If trunk has multiple stacks branching from it:

Fork Handling

All four navigation commands handle forks (branches with multiple children) gracefully:
  • gx up and gx top stop at forks and list the options
  • gx down and gx bottom always have a single path (each branch has exactly one parent)
  • Cycle detection prevents infinite loops from corrupted configs
All navigation commands warn if you have uncommitted changes: WARN You have uncommitted changes. They may conflict with the target branch.
  • Navigation uses the stack config (.git/gx/stack.json) to determine parent/child relationships
  • gx top walks up from the current branch, following single children until reaching a leaf or fork
  • gx bottom walks down from the current branch toward trunk, stopping at the first branch whose parent is trunk
  • All commands include cycle detection to handle corrupted stack configs safely
  • If gx detects a cycle, it prints WARN Cycle detected in stack config. and stops