Skip to content

A command-line tool to delete all git local and remote branches except 'main'. Delete Git branches in bulk.

License

Notifications You must be signed in to change notification settings

serNAVARRO7/branchkiller

Repository files navigation

Branch Killer

branchkiller logo

npm npm version NPM

A command-line tool to easily delete all git local and remote branches except 'main'. Delete Git branches in bulk ✂️

Table of Contents

✔️ Features

  • Delete Local Branches: Easily manage and remove unnecessary local branches in your Git repository with an interactive CLI interface.

  • Delete Remote Branches: Clean up remote branches that are no longer needed by pushing deletions directly to the origin.

  • Branch Exclusion: Exclude specific branches (e.g., main, origin/main) from being selected for deletion to avoid accidental removal of important branches.

  • Interactive Selection: Choose which branches to delete through a user-friendly prompt, with checkboxes for easy multi-selection.

  • Confirmation Step: Prevent accidental deletions by requiring confirmation before proceeding with branch removal.

☁️ Installation

$ npm i -g branchkiller

📋 Usage

$ branchkiller

By default, branchkiller will scan your local and remote branches, excluding branches like your current local branch, main and origin/main from being selected for deletion.

Options

ARGUMENT DESCRIPTION
-e, --exclude [branches...] Exclude branches (default: ["main","origin/main",current local branch])
--no-local Do not delete local branches
--no-remote Do not delete remote branches
--no-interactive Do not ask for confirmation before deleting branches
-V, --verbose Be verbose when deleting branches, showing them as they are deleted
-h, --help Display help for command
-v, --version Display branchkiller version

Examples

  • Exclude local branch
branchkiller --exclude mylocalbranch

# other alternative:
branchkiller -e mylocalbranch
  • Exclude remote branch
branchkiller --exclude origin/myremotebranch

# other alternative:
branchkiller -e origin/myremotebranch
  • Exclude multiple branches (local and remote)
branchkiller --exclude mylocalbranch origin/myremotebranch

# other alternative:
branchkiller -e mylocalbranch origin/myremotebranch

🛠️ Contributing

Contributions are welcome! Please feel free to fork the repository, make changes, and submit pull requests.

📜 License

MIT © Sergio Navarro

About

A command-line tool to delete all git local and remote branches except 'main'. Delete Git branches in bulk.

Topics

Resources

License

Stars

Watchers

Forks