wt-cleanup
Identify and remove merged or stale git worktrees. Use for housekeeping, removes worktrees for branches that have been merged to main. Frees disk space.
When & Why to Use This Skill
The wt-cleanup Claude skill automates Git worktree maintenance by identifying and removing stale or merged branches. It optimizes developer workflows by reclaiming disk space and pruning git metadata, ensuring a clean and efficient local development environment through smart detection and interactive cleanup.
Use Cases
- Post-Merge Housekeeping: Automatically identify and delete worktrees associated with feature branches that have already been merged into the main or develop branch.
- Disk Space Management: Quickly reclaim storage space on local machines by removing large, unused worktree directories that are no longer needed for active development.
- Git Metadata Pruning: Clean up stale git references and metadata to prevent repository bloat and maintain a high-performance development environment.
- Workflow Organization: Simplify the list of active worktrees during multi-tasking to reduce cognitive load and focus only on current, relevant tasks.
| name | wt-cleanup |
|---|---|
| description | Identify and remove merged or stale git worktrees. Use for housekeeping, removes worktrees for branches that have been merged to main. Frees disk space. |
/wt:cleanup - Clean Up Merged Worktrees
Description
Quick command to identify and remove merged or stale worktrees.
Usage
/wt:cleanup
What It Does
This slash command:
- Activates the Git Worktree Manager skill (
@git-worktree) - Automatically runs the
*cleanupcommand - Helps you clean up old worktrees
Workflow
The command will:
- List all worktrees - Show all active worktrees
- Identify merged branches - Find branches already merged to main/develop
- Ask which to remove - Interactive selection
- Remove selected worktrees - Safely delete worktrees
- Prune worktree references - Clean up git metadata
Benefits
✅ Smart Detection - Identifies merged branches automatically ✅ Safe Cleanup - Only suggests merged branches ✅ Selective Removal - Choose which to remove ✅ Complete Cleanup - Removes worktrees and branches
Notes
- Only suggests worktrees with merged branches
- You can choose which ones to remove
- Warns about unmerged branches
- Prunes git metadata after cleanup