branch-cleanup

Identify and remove merged Git branches locally and remotely after confirmation.

11|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/berkcangumusisik/claude-code-practices --skill branch-cleanup-berkcangumusisik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: branch-cleanup
Source: https://github.com/berkcangumusisik/claude-code-practices/tree/main/skills/branch-cleanup
Command: npx skills add https://github.com/berkcangumusisik/claude-code-practices --skill branch-cleanup-berkcangumusisik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers maintain a clean Git repository by identifying and safely deleting local and remote branches that have already been merged into the main branches, reducing clutter and minimizing confusion.

Core Features & Use Cases

  • Identify local branches that have been merged into main or master.
  • Detect remote-tracking branches that are stale or merged.
  • Present a clear list of candidates and require explicit confirmation before deletions.
  • Generate a concise report detailing what was deleted and what was skipped.

Quick Start

Run the branch cleanup workflow in your repository and confirm deletions when prompted.

Frequently Asked Questions about branch-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up stale Git branches that have been merged?▼

This workflow identifies and safely deletes local and remote branches already merged into your main or master branch. It presents a clear list of candidate branches and requires explicit confirmation before performing any deletions.

Does deleting merged branches affect the main or master branch?▼

No, the cleanup process explicitly avoids protected branches like main and master. It safely removes only the merged feature branches while ensuring your primary main or master branches are never deleted.

Can I remove both local and remote stale branches at the same time?▼

Yes, the workflow detects and removes both local branches and remote-tracking branches that are stale or merged. It presents a unified list of candidates for explicit confirmation before deleting them simultaneously.

What is the safest way to delete Git branches without losing unmerged work?▼

The safest way to delete Git branches is using a workflow that requires explicit user confirmation before deletion. This process identifies only merged branches, lists candidates clearly, skips protected branches, and generates a report of what was deleted and skipped.

How do I identify which Git branches are safe to delete?▼

To identify which Git branches are safe to delete, look for branches that have been merged into main or master. The workflow automatically lists these candidates, avoids protected branches, and requires explicit confirmation before proceeding.