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:
# 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
- Report what was deleted and what was skipped.
Use this skill with your AI agent:
Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.