eval-test-skill

Git branch cleanup utility. Lists and deletes branches that have been merged to main. Use when user wants to clean up old branches, delete merged branches, or tidy up their git repository.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill provides an automated utility for cleaning up local Git repositories. It efficiently identifies and deletes branches that have already been merged into the main branch, helping developers maintain a tidy and manageable workspace while ensuring safety by protecting critical branches like main and master.

Use Cases

  • Post-Merge Cleanup: Quickly remove local feature branches after they have been successfully integrated into the main codebase to reduce repository clutter and confusion.
  • Routine Workspace Maintenance: Periodically scan and purge stale branches to keep the local development environment organized and improve overall workflow efficiency.
  • Safe Bulk Deletion: Safely delete multiple merged branches at once using built-in safeguards that prevent the accidental removal of protected branches or currently checked-out work.
nameeval-test-skill
descriptionGit branch cleanup utility. Lists and deletes branches that have been merged to main. Use when user wants to clean up old branches, delete merged branches, or tidy up their git repository.

Git Branch Cleanup

Clean up merged git branches from local repository.

Workflow

  1. List merged branches - Show branches already merged to main
  2. Confirm deletion - Ask user which branches to delete
  3. Delete branches - Remove selected merged branches

Commands

List merged branches

git branch --merged main | grep -v "^\*\|main\|master"

Delete a single branch

git branch -d <branch-name>

Delete all merged branches (except main/master)

git branch --merged main | grep -v "^\*\|main\|master" | xargs -r git branch -d

Safety

  • Only delete branches merged to main (use -d not -D)
  • Never delete main or master
  • Never delete currently checked out branch
  • Show list before deletion for user confirmation