Files
leo-claude-mktplace/plugins/git-flow/commands/branch-cleanup.md
lmiranda 7c8a20c804 refactor: extract skills from commands across 8 plugins
Refactored commands to extract reusable skills following the
Commands → Skills separation pattern. Each command is now <50 lines
and references skill files for detailed knowledge.

Plugins refactored:
- claude-config-maintainer: 5 commands → 7 skills
- code-sentinel: 3 commands → 2 skills
- contract-validator: 5 commands → 6 skills
- data-platform: 10 commands → 6 skills
- doc-guardian: 5 commands → 6 skills (replaced nested dir)
- git-flow: 8 commands → 7 skills

Skills contain: workflows, validation rules, conventions,
reference data, tool documentation

Commands now contain: YAML frontmatter, agent assignment,
skills list, brief workflow steps, parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:32:24 -05:00

50 lines
1.3 KiB
Markdown

---
name: branch-cleanup
description: Remove merged and stale branches locally and optionally on remote
agent: git-assistant
---
# /branch-cleanup - Clean Merged and Stale Branches
## Skills
- skills/visual-header.md
- skills/git-safety.md
- skills/sync-workflow.md
- skills/environment-variables.md
## Purpose
Remove branches that have been merged OR whose remote tracking branch no longer exists.
## Parameters
| Parameter | Description |
|-----------|-------------|
| `--dry-run` | Preview without deleting |
| `--remote` | Also delete remote branches |
| `--stale-only` | Only delete stale branches (upstream gone) |
## Workflow
1. **Display header** - Show GIT-FLOW Branch Cleanup header
2. **Prune remote refs** - `git fetch --prune`
3. **Find merged branches** - `git branch --merged <base-branch>`
4. **Find stale branches** - `git branch -vv | grep ': gone]'`
5. **Exclude protected** - Never delete protected branches (per git-safety.md)
6. **Present findings** - Show merged, stale, and protected lists
7. **Confirm deletion** - Options: all, merged only, stale only, pick, cancel
8. **Execute cleanup** - Delete selected branches
9. **Report** - Show deletion summary
## Output
```
Cleaned up:
Local (merged): 3 branches deleted
Local (stale): 2 branches deleted
Remote: 2 branches deleted
Repository is tidy!
```