| 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
- Show current state:
git branch -vv
git branch --merged main 2>/dev/null || git branch --merged master
- List candidates for deletion:
- Local branches merged into main/master
- Local branches with gone remote tracking refs
- Remote branches merged into main (requires confirmation)
-
Show the list to the user with what would be deleted. Ask for confirmation before deleting anything.
-
On confirmation:
git branch --merged main | grep -vE '^\*|main|master|develop|staging' | xargs -r git branch -d
- Report what was deleted and what was skipped.