Skip to main content
gx switch provides an interactive branch picker with search filtering, sorted by most recently committed. Each branch shows its age and author for quick context.

Usage

Arguments

Interactive Picker

When run without arguments, gx lists all branches (excluding the current one) sorted by most recent commit:
  • Enter a number to switch to that branch
  • Type text to filter branches by name (case-insensitive substring match)
  • Enter q or press Enter with no input to cancel
If there is only one other branch, gx switches to it automatically without showing the picker.

Quick Switch

The - shortcut switches to the previous branch, just like git switch -:

Examples

If you have uncommitted changes, gx prints a warning before showing the picker: WARN You have uncommitted changes. They may conflict with the target branch.
  • If there are no other branches, gx prints > No other branches to switch to.
  • Branch names longer than 45 characters are truncated with ... in the picker display
  • The picker supports repeated filtering — entering new text replaces the previous filter
  • If gx switch - has no previous branch (new repo), gx prints ERROR No previous branch to switch to.