A powerful CLI tool for managing Git branches with features for safe deletion, interactive selection, and branch cleanup.
- 🔍 List local and remote branches with detailed status
- 🗑️ Safely delete branches with protection for default branches
- 🤝 Interactive mode for selecting multiple branches
- 🧹 Prune stale and merged branches
- 🎨 Color-coded output for better visibility
- 🔒 Protected branches configuration
- 🔄 Remote branch handling
go install github.com/bral/git-branch-delete-go@latestbrew install brannonlucas/tap/git-branch-deleteDownload the latest release from the releases page.
# List local branches
git-branch-delete list
# List remote branches
git-branch-delete list --remote
# List all branches
git-branch-delete list --all# Select branches to delete interactively
git-branch-delete interactive
# or use the shorthand
git-branch-delete i# Show stale branches
git-branch-delete prune --dry-run
# Delete stale branches (with confirmation)
git-branch-delete prune
# Force delete stale branches
git-branch-delete prune --forceCreate ~/.config/git-branch-delete.yaml:
# Override default branch detection
default_branch: main
# Protect specific branches from deletion
protected_branches:
- main
- master
- develop
# Default remote (default: origin)
default_remote: origin
# Skip confirmation prompts
auto_confirm: false
# Show what would be deleted without actually deleting
dry_run: falseEnvironment variables are also supported:
GBD_DEFAULT_BRANCHGBD_DEFAULT_REMOTEGBD_AUTO_CONFIRMGBD_DRY_RUN
# Bash
source <(git-branch-delete completion bash)
# Zsh
source <(git-branch-delete completion zsh)
# Fish
git-branch-delete completion fish | source
# PowerShell
git-branch-delete completion powershell | Out-String | Invoke-Expression- Go 1.22 or later
- Make
# Clone the repository
git clone https://github.com/bral/git-branch-delete-go.git
cd git-branch-delete-go
# Install dependencies
make deps
# Build
make build
# Run tests
make testmake build- Build the binarymake test- Run testsmake clean- Clean build artifactsmake install- Install to $GOPATH/binmake deps- Install dependencies
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -am 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file