Interactive git branch deletion tool for ZSH with a beautiful UI.
- 🎯 Interactive selection - Use checkboxes to select/unselect branches
- 📊 Rich information - See last commit date and message for each branch
- 🛡️ Safety first - Automatically protects current branch and main/master
- ⚡ Fast and smooth - Powered by gum
- 🎨 Beautiful UI - Clean, modern interface with colors
Install gum:
brew install gum- Clone this repository into Oh My Zsh's custom plugins directory:
git clone https://github.com/adelbeke/git-clean-branches.git \
$ZSH_CUSTOM/plugins/git-clean-branches- Add the plugin to your
.zshrc:
plugins=(... git-clean-branches)- Reload your shell:
source ~/.zshrc- Clone the repository:
git clone https://github.com/adelbeke/git-clean-branches ~/git-clean-branches- Source the plugin in your
.zshrc:
source ~/git-clean-branches/git-clean-branches.plugin.zsh- Reload your shell:
source ~/.zshrcgit-clean-branchesOr use the short alias:
gcbgit-clean-branches [OPTIONS]
OPTIONS:
-f, --force Force delete branches (even if not fully merged)
-h, --help Show help message
-v, --version Show versionSafe delete (only merged branches):
git-clean-branchesForce delete (including unmerged branches):
git-clean-branches --forceUsing the alias:
gcb -f- Lists all branches - Except current branch and protected branches (main, master, develop, development)
- Shows information - Displays last commit date and message for each branch
- Interactive selection - Use space to select/unselect, enter to confirm
- Confirmation - Shows summary and asks for final confirmation
- Deletion - Deletes selected branches with progress feedback
The following branches are automatically protected and won't appear in the list:
- Current branch (the one you're on)
mainmasterdevelopdevelopment
- Safe delete by default - Uses
git branch -dwhich only deletes merged branches - Force option - Use
--forceto delete unmerged branches withgit branch -D - Clear feedback - Shows which branches were deleted and which failed
- Cancellation - Can cancel at any point with Ctrl+C or by saying "No" to confirmation
Install gum:
brew install gumMake sure you're inside a git repository:
cd /path/to/your/git/repoUse the force option:
git-clean-branches --forceContributions are welcome! Feel free to open issues or submit pull requests.
MIT License - see LICENSE file for details
Built with:
- gum - A tool for glamorous shell scripts
- ZSH - The Z shell
Made with ❤️ for developers who like clean repositories
