git-branch-cleanup
Installation
SKILL.md
Git Branch Cleanup
Remove local worktrees and branches whose changes are provably absorbed somewhere else, and only after the user approves each group.
Produce two independent groups based on risk:
- Group 1 (landed): the work is on the remote default branch. Deleting loses nothing because the remote holds it.
- Group 2 (absorbed locally): the work is in the branch currently checked out in this worktree (the integration branch) but not yet on the remote default. Deleting loses nothing as long as that integration branch survives.
A branch in Group 1 or Group 2 is a candidate. Every other branch is non-deletable here and is only reported.
When to Use
- After merging pull requests, especially squash merges.
- After a fan-out agent session that left
worktree/*or feature branches and worktree directories behind (e.g. herdr-managed worktrees), including ones already merged into the integration branch the agent is standing on. - The user asks to clean up branches or worktrees, delete merged branches, or list what is safe to remove.