Skip to content
Back to skills

Branch Cleanup

ASecurity

Lists and removes stale local and remote branches that have been merged

  • 10 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
ai-agentsgobashgit

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill branch-cleanup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Branch Cleanup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Branch Cleanup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-branch-cleanup/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-branch-cleanup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: branch-cleanup
description: Lists and removes stale local and remote branches that have been merged
user-invocable: true
allowed-tools: Bash(git *)
effort: low
---

## Branch Cleanup

1. Show current state:
```bash
git branch -vv
git branch --merged main 2>/dev/null || git branch --merged master
```

2. List candidates for deletion:
- Local branches merged into main/master
- Local branches with gone remote tracking refs
- Remote branches merged into main (requires confirmation)

3. Show the list to the user with what would be deleted. Ask for confirmation before deleting anything.

4. On confirmation:
```bash
# Delete merged local branches (never delete main/master/develop/staging)
git branch --merged main | grep -vE '^\*|main|master|develop|staging' | xargs -r git branch -d
```

5. Report what was deleted and what was skipped.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…