A command-line tool written in Go for interactively deleting Git branches. This is a Go implementation of the original TypeScript tool.
- Interactive branch selection with colored output
- Shows detailed branch information:
- Commit hash
- Last commit message
- Merge status (green if merged, red if not)
- Safe deletion with confirmation
- Prevents deletion of current branch
- Vim-style navigation (Ctrl+N, Ctrl+P)
To install globally:
go install github.com/bral/git-branch-delete-go/cmd/git-branch-delete@latest
Or build from source:
git clone https://github.com/brannonlucas/git-branch-delete-go.git
cd git-branch-delete-go
go build ./cmd/git-branch-delete
After building from source, you can:
- Run it directly:
./git-branch-delete
- Move it to your PATH:
mv git-branch-delete /usr/local/bin/
- Navigate to a Git repository
- Run
git-branch-delete
- Use arrow keys or Ctrl+N/P to navigate branches
- Press space to select branches for deletion
- Press enter to confirm selection
- Type 'y' to confirm deletion
- ↑/↓: Navigate through branches
- Ctrl+N: Next branch
- Ctrl+P: Previous branch
- Space: Select/deselect branch
- Enter: Confirm selection
- Ctrl+C: Exit without deleting
Branches are displayed in the following format:
branch-name [a1b2c3d] Commit message... (merged) # in green if merged
other-branch [e4f5g6h] WIP: New feature... (not merged) # in red if not merged
- Branch name
- Commit hash in square brackets
- Truncated commit message (max 30 chars)
- Merge status in parentheses (colored)
- Go 1.21 or higher
- Git installed and accessible in PATH
- github.com/fatih/color: Terminal color output
- github.com/manifoldco/promptui: Interactive terminal prompts
- golang.org/x/term: Terminal utilities