clean-branches

Community

Safely prune merged and stale Git branches.

Authorgupsammy
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill helps developers safely remove merged and stale branches from Git repositories, reducing clutter and minimizing the risk of accidental deletions.

Core Features & Use Cases

  • Merged branches cleanup: identifies and lists branches already merged into main (excluding protected ones) so they can be removed with confirmation.
  • Stale branches detection: finds branches without commits for an extended period and flags them for review.
  • Safe deletion workflow: requires explicit confirmation before deleting locally, with optional remote deletions when requested.

Quick Start

Use the clean-branches skill to preview and delete branches as follows.

  1. Update local state: git fetch --all --prune
  2. Identify merged branches (safe to delete): git branch --merged main | grep -v "^*|main|master|develop"
  3. Identify stale branches (no recent commits): git for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:relative)' refs/heads/ | while read branch date; do if [[ "$date" == "months" ]] || [[ "$date" == "year" ]]; then echo "$branch ($date)" fi done
  4. Confirm and delete:
  • If you want to delete all merged branches locally: git branch -d <branch-name>
  • If remote cleanup is desired: git push origin --delete <branch-name>

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: clean-branches
Download link: https://github.com/gupsammy/Claude-setup/archive/main.zip#clean-branches

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.