npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-smart-clean

v1.1.0

Published

Smart cleanup tool for merged git branches

Readme

git-smart-clean

🧹 Smart cleanup tool for merged git branches

Installation

npm install -g git-smart-clean

Usage

Basic Usage

# Interactive mode
git-smart-clean

# Preview without deleting
git-smart-clean --dry-run

# Exclude specific branches
git-smart-clean --exclude "main,develop,staging"

# Only branches older than X days
git-smart-clean --older-than 90

Options

git-smart-clean [options]

Options:
  -V, --version              output the version number
  -d, --dry-run              Preview without deleting
  --older-than <days>        Only branches older than X days
  --exclude <branches>       Branches to exclude (default: "main,master,develop")
  -h, --help                 display help for command

Features

✅ Interactive branch selection
✅ Dry-run mode for safety
✅ Shows branch age (committed X ago)
✅ Color-coded by age (red/yellow/green)
✅ Sorted by age (oldest first)
✅ Auto-excludes protected branches
✅ Beautiful terminal UI
✅ Safe confirmation prompts

Examples

# Basic cleanup
git-smart-clean

# Preview first (recommended)
git-smart-clean --dry-run

# Only very old branches
git-smart-clean --older-than 180

# Exclude custom branches
git-smart-clean --exclude "main,staging,production,develop"

# Combine options
git-smart-clean --older-than 90 --exclude "main,dev" --dry-run

How It Works

  1. Scans for merged branches in your current repository
  2. Excludes protected branches (main, master, develop, and current branch)
  3. Shows branch age based on last commit date
  4. Color codes by age:
    • 🔴 Red: Older than 3 months
    • 🟡 Yellow: 1-3 months old
    • 🟢 Green: Less than 1 month
  5. Lets you select which branches to delete (all pre-selected)
  6. Confirms before deleting
  7. Deletes selected branches safely

Screenshots

Dry Run Mode

✔ Found 5 merged branches

🔍 DRY RUN - No branches will be deleted

  • feature/old-authentication              (committed 2 months ago)
  • bugfix/payment-gateway-fix              (committed 3 weeks ago)
  • hotfix/urgent-security-patch            (committed 2 days ago)

Would delete 3 branches

Interactive Mode

✔ Found 5 merged branches

? Select branches to delete (Space to select, Enter to confirm):
>(*) feature/old-authentication              (committed 2 months ago)
 (*) bugfix/payment-gateway-fix              (committed 3 weeks ago)
 ( ) hotfix/urgent-security-patch            (committed 2 days ago)

Filter by Age

Only show branches older than a specific number of days:

```bash
# Only branches older than 30 days
git-smart-clean --older-than 30

# Only branches older than 90 days
git-smart-clean --older-than 90 --dry-run

# Only branches older than 6 months (180 days)
git-smart-clean --older-than 180

Useful for:

  • Quarterly cleanup: --older-than 90
  • Yearly cleanup: --older-than 365
  • Find very old branches: --older-than 180

## Development

```bash
# Clone the repo
git clone https://github.com/husseinjaafar27/git-smart-clean.git
cd git-smart-clean

# Install dependencies
npm install

# Test locally
npm link
git-smart-clean --dry-run

# Run in another repo
cd ~/some-other-repo
git-smart-clean

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © husseinjaafar27

Support

If you find this tool helpful, please ⭐ star the repo!

Found a bug? Open an issue