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
| Argument | Description |
|---|---|
- | Switch to the previous branch (like git switch -) |
branch | Switch directly to a named branch |
| (none) | Open the interactive picker |
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
qor press Enter with no input to cancel
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.Edge cases
Edge cases
- 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 printsERROR No previous branch to switch to.