git-reaper
Version:
A CLI tool to manage git branches and clean up stale branches.
125 lines (88 loc) • 2.46 kB
Markdown
# Git Reaper
[](LICENSE)
[](https://nodejs.org/)
## Description
Git Reaper is a command-line interface (CLI) tool designed to help developers manage their local Git branches efficiently. It allows users to list, review, and delete old or unused branches with ease, ensuring a cleaner and more organized workspace.
## Table of Contents
- [Features](#features)
- [Technologies Used](#technologies-used)
- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
- [License](#license)
## Features
- List all local Git branches with detailed information.
- Interactive selection and deletion of branches.
- Confirmation prompts to prevent accidental deletions.
- Colorful and user-friendly CLI output.
- Easy integration with existing Git workflows.
## Technologies Used
- **Node.js** (>= 18.x)
- **Commander.js** – CLI command parser
- **Clack** – Interactive CLI prompts
- **Colorette** – Terminal string styling
- **Git** – Underlying version control system
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/migudevelop/git-reaper.git
cd git-reaper
```
2. **Install dependencies:**
```bash
npm install
# or
pnpm install
```
2. **Or Install the CLI globally:**
```bash
npm install -g git-reaper
# or
pnpm install -g git-reaper
```
3. **(Optional) Link the CLI globally:**
```bash
npm link
```
## Usage
### Run the CLI
```bash
npx git-reaper
# or, if linked globally:
git-reaper
```
### List all branches
```bash
git-reaper
```
### Delete branches interactively
```bash
git-reaper --delete
```
## Examples
### Listing Branches
```bash
$ git-reaper
* main (a1b2c3d): Initial commit - John Doe (2 weeks ago) (current branch)
feature/login (d4e5f6g): Add login page - Jane Smith (1 week ago)
fix/typo (h7i8j9k): Fix typo in README - John Doe (3 days ago)
```
### Deleting Branches
```bash
$ git-reaper --delete
? Select branches to delete:
◯ feature/login (d4e5f6g): Add login page - Jane Smith (1 week ago)
◯ fix/typo (h7i8j9k): Fix typo in README - John Doe (3 days ago)
✔ Are you sure you want to delete the selected branches? (y/N)
Branches deleted successfully.
```
## License
This project is licensed under the [MIT License](LICENSE).