wt-cleanup

michael-menard's avatarfrom michael-menard

Identify and remove merged or stale git worktrees. Use for housekeeping, removes worktrees for branches that have been merged to main. Frees disk space.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 28, 2025

When & Why to Use This Skill

The wt-cleanup skill is a specialized utility designed to streamline Git workspace management by identifying and removing merged or stale worktrees. It enhances developer productivity by automating the housekeeping process, ensuring that only active projects occupy disk space while safely pruning redundant metadata and branches.

Use Cases

  • Routine Workspace Maintenance: Periodically cleaning up worktrees after completing and merging multiple feature branches to keep the local development environment organized.
  • Disk Space Optimization: Quickly reclaiming storage on development machines by identifying and removing large worktrees associated with branches that have already been merged into the main codebase.
  • Safe Metadata Pruning: Automating the identification of stale git references and metadata to prevent configuration drift and ensure a clean git state without the risk of deleting unmerged work.
namewt-cleanup
descriptionIdentify 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:

  1. Activates the Git Worktree Manager skill (@git-worktree)
  2. Automatically runs the *cleanup command
  3. Helps you clean up old worktrees

Workflow

The command will:

  1. List all worktrees - Show all active worktrees
  2. Identify merged branches - Find branches already merged to main/develop
  3. Ask which to remove - Interactive selection
  4. Remove selected worktrees - Safely delete worktrees
  5. 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