eval-test-skill

otrebu's avatarfrom otrebu

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.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025⬇️2downloads

When & Why to Use This Skill

This Claude skill automates Git repository maintenance by identifying and deleting local branches that have already been merged into the main branch. It helps developers maintain a clean and organized workspace, reducing cognitive load and preventing branch clutter while ensuring safety through merged-only deletion logic and protected branch filters.

Use Cases

  • Post-Feature Completion: Quickly remove local feature branches after they have been successfully merged into the main codebase to keep the branch list manageable.
  • Routine Repository Maintenance: Periodically scan and purge stale branches to improve Git command readability and simplify branch navigation during daily development.
  • Safe Bulk Deletion: Safely clean up dozens of merged branches at once using automated filters that protect critical branches like main/master and the currently active branch.
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