Clean up git branches
cleancommandsetup L2★17,464
alirezarezvani/claude-skills ↗What it does
Remove stale Git branches from local and remote repositories
Best for
Automated cleanup of merged and stale branches while preserving main, dev, and gh-pages.
Inputs
- · Git repository with merged branches
- · Protect list: main, dev, gh-pages
Outputs
- · Summary table with counts: local branches deleted, remote branches deleted
- · Final state: remaining local and remote branches
- · Pruned stale refs from origin
Requires
- · git branch (list/delete local)
- · git push origin --delete (remove remote)
- · git remote prune (clean refs)
Preconditions
- · User in Git repository root
- · Origin remote configured
- · Merged status determinable via git branch -d
Failure modes
- · Force-delete required if branch not fully merged (user confirmation needed)
- · Stale remote refs orphaned if git remote prune not run
- · Protected branches accidentally deleted if filter regex broken
Trust signals
- · Explicit list/confirm/delete three-step workflow
- · User confirmation required before remote deletions
- · Force-delete decision deferred to user, not automated
- · Prune step included to clean orphaned refs
- · Final state reporting for verification