A fast, minimal terminal UI for switching Git branches — with GitHub PR status and titles shown inline.
- Browse and switch local branches from an inline terminal panel
- Displays last commit date and message per branch
- Fetches PR titles and statuses (open, merged, closed) in the background (requires
GITHUB_TOKEN) - Sync local branches: delete branches whose PR has been merged or closed with
Ctrl+S - Keyboard-driven: no mouse needed
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lethib/gswr/releases/download/v2.0.0/gswr-installer.sh | shmacOS only (Apple Silicon & Intel). Linux and Windows support coming soon.
Run gswr from anywhere inside a Git repository:
gswr| Key | Action |
|---|---|
↑ / k |
Move up |
↓ / j |
Move down |
↵ |
Switch to selected branch |
Shift+D |
Delete selected branch (not allowed on main branch) |
Ctrl+S |
Sync branches (delete merged/closed) |
q / Ctrl+C |
Quit |
To display PR titles and statuses next to each branch, export a GitHub personal access token:
export GITHUB_TOKEN=your_token_hereEach branch displays a status indicator:
| Status | Meaning |
|---|---|
O |
Open PR |
M |
Merged PR |
C |
Closed PR |
Without GITHUB_TOKEN, PR information is not shown.
Press Ctrl+S to delete all local branches whose PR has been merged (M) or closed (C). A confirmation prompt will appear:
- Press
↵to confirm (safe mode: only deletes branches with a merged/closed PR) - Press
⌥↵(Alt+Enter) to also delete local branches with no linked PR — unsafe mode, skips branches without a PR status (the main branch is always protected) - Press
cto cancel
The main branch is always protected and cannot be deleted, whether individually or during sync.
If you use oh-my-zsh with the git plugin, gsw is already aliased to git switch. You may want to alias gswr to a shorter name in your .zshrc:
alias gsw=gswrThis overrides the oh-my-zsh gsw alias with gswr. If you still need the original git switch shorthand, use git switch directly or pick a different alias.
- macOS (Apple Silicon or Intel)
- Must be run from inside a Git repository
MIT
