🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

git-clean-branches-cli

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-clean-branches-cli - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+64
Readme.md
# git-clean-branches
A simple CLI tool to delete all local Git branches except the ones you want to keep.
Perfect for keeping your repo clean without manually deleting dozens of branches.
## Installation
Global install (recommended)
`npm install -g git-clean-branches`
Or use with npx
`npx git-clean-branches main develop`
## Usage
> git-clean [options] <branches-to-keep...>
Example
`git-clean main develop`
This will:
Keep main, develop, and your current branch
Delete all other local branches
## Options
> --dry-run
Preview what will be deleted without actually deleting anything.
`git-clean --dry-run main develop`
> --force
Force delete branches (uses git branch -D instead of -d).
`git-clean --force main develop`
## How it works
- Fetches all local branches
- Automatically includes your current branch in the keep list
- Filters out branches you want to keep
- Prompts for confirmation before deletion
- Deletes remaining branches safely (or forcefully if specified)
## Safety Features
- Never deletes the current branch
- Confirmation prompt before deletion
- Dry-run mode to preview changes
- Safe delete by default (-d)
## Sample Output
Keeping branches: main, develop, feature-x
Branches to delete:
feature-old
bugfix-123
Are you sure you want to delete these branches? (y/N):
## Tips
- Use --dry-run first to avoid mistakes
- Use --force only when you're sure branches can be safely removed
- Great to run after merging PRs
## Requirements
- Node.js >= 14
- Git installed and available in PATH
## License
MIT
+1
-1
{
"name": "git-clean-branches-cli",
"version": "1.0.0",
"version": "1.0.1",
"description": "CLI to delete all local git branches except specified ones",

@@ -5,0 +5,0 @@ "bin": {