@alcozy/git-janitor
v1.0.0
Published
An interactive CLI tool to clean up your local and remote Git branches.
Readme
Git Janitor
A powerful, interactive command-line interface (CLI) tool authored by Alex L. Cosentino to easily clean up and manage Git branches.
Stop typing out endless git branch -d commands. Git Janitor provides a beautiful, keyboard-navigated menu to safely prune merged branches, force-delete stale work, and seamlessly check out branches, keeping your local and remote repositories spotless.
Features
- Auto-Prune: Automatically detects and deletes all local branches that have been successfully merged into your primary branch (
main/master). - Soft & Hard Deletes: Safely delete branches via an interactive multi-select menu, with built-in safeguards to prevent accidental deletion of unmerged work unless explicitly forced.
- Remote Syncing: Optionally sync your deletions to the remote repository (
origin) with a single keystroke. - Interactive Checkout: View a visual graph of your recent commit history and easily switch between active branches without leaving the CLI.
- Safety First: Built-in protections prevent you from deleting your current active branch or your primary repository branch.
Installation
Global Installation
You can install Git Janitor globally on your machine using npm:
npm install -g @alcozy/git-janitorRun without installing (npx)
If you prefer not to install it globally, you can run it instantly using npx:
npx @alcozy/git-janitorUsage
Navigate to any Git repository on your machine and simply run:
git-janitorUse your arrow keys to navigate the menu and Spacebar to select multiple branches for deletion.
Tech Stack
- TypeScript & Node.js Child Processes
- @clack/prompts for the interactive terminal UI
- Figlet & Picocolors for terminal typography and styling
Local Development / Contributing
If you want to modify the source code or build the project locally:
- Clone the repository:
git clone https://github.com/aluciencozy/git-janitor.git
cd git-janitor- Install dependencies:
npm install- Compile the TypeScript:
npm run build- Link the package globally:
npm link