UNPKG

@ebuka_dev/git-branch-cleaner

Version:

A CLI tool to help manage and clean up Git branches

132 lines (89 loc) 3.15 kB
# Git Branch Cleaner A command-line tool to help manage and clean up Git branches in your repository. Simplify your git branch management with interactive selection, safe deletions, and clear status indicators. ## Features - 🌳 Interactive branch selection with spacebar - 🔍 List all branches with status indicators - 🗑️ Clean up stale and merged branches - 🔒 Safe deletion with protected branches (main/master) - 📝 Verbose mode for detailed branch information - ✨ Beautiful CLI interface with color coding ## Installation ```bash # Install globally using npm npm install -g @ebuka_dev/git-branch-cleaner # Or use with npx npx @ebuka_dev/git-branch-cleaner ``` ## Usage ### List All Branches Show all branches in the repository with status indicators: ```bash git-branch-cleaner list-all ``` - Current branch is marked with green `*` - Stale branches are shown in red - Active branches are shown in gray ### Delete Branches Interactive branch deletion with multi-select: ```bash git-branch-cleaner delete ``` Use: - Spacebar to select/unselect branches - Arrow keys to navigate - Enter to confirm selection - Ctrl+C to cancel Options: - `--force`: Force delete branches without confirmation You can also delete specific branches directly: ```bash git-branch-cleaner delete branch1 branch2 ``` ### List Stale Branches Show branches whose remote tracking branch is gone: ```bash git-branch-cleaner list-stale ``` Options: - `-v, --verbose`: Show detailed branch information ### Clean Merged Branches List and optionally delete branches that have been merged: ```bash git-branch-cleaner clean-merged ``` Options: - `-v, --verbose`: Show detailed branch information - `--auto-delete`: Automatically delete without confirmation ## Status Indicators - 🟢 `*`: Current branch - 🔴 Red: Stale branch (remote is gone) - ⚪ Gray: Normal branch - 🟡 Yellow: Warning messages - 🟦 Blue: Information messages - ✨ Sparkle: Successful deletion ## Safety Features - Protected branches (main/master) cannot be deleted - Confirmation prompt before deletion - Clear error messages - Interactive selection to prevent mistakes - Color-coded status for better visibility ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. 1. Fork the repository 2. Create your feature branch 3. Commit your changes 4. Push to the branch 5. Open a Pull Request ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## Author Joseph Ebuka - [ebukaj665@gmail.com](mailto:ebukaj665@gmail.com) ## Support If you find this tool helpful, please consider: - Giving it a ⭐ on GitHub - Reporting any issues you encounter - Sharing it with others who might find it useful ## Links - [GitHub Repository](https://github.com/Joseph-Ebuka/git-branch-cleaner) - [NPM Package](https://www.npmjs.com/package/@ebuka_dev/git-branch-cleaner) - [Bug Reports](https://github.com/Joseph-Ebuka/git-branch-cleaner/issues)