cleanup-worktrees

Remove stale Git worktrees and prune related branches.

26|2|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/sburl/CrossCheck --skill cleanup-worktrees-sburl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-worktrees
Source: https://github.com/sburl/CrossCheck/tree/main/codex/skills/cleanup-worktrees
Command: npx skills add https://github.com/sburl/CrossCheck --skill cleanup-worktrees-sburl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cleaning up unused Git worktrees to reclaim disk space and keep repos organized after PRs are merged.

Core Features & Use Cases

  • Automatically identify finished or abandoned worktrees based on merge status and recent activity.
  • Interactive removal with safety checks and configurable modes (safe, aggressive, dry-run).
  • Works across typical Git workflows to maintain a clean local development environment.

Quick Start

Run /cleanup-worktrees to safely remove completed and abandoned worktrees.

Frequently Asked Questions about cleanup-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up stale git worktrees and reclaim disk space?

You can remove stale git worktrees by identifying candidates based on merge status and recent activity, then executing interactive removal with safety checks. This reclaims disk space and reduces repository clutter.

What is the best way to prune merged PR branches and abandoned worktrees?

The best way to prune abandoned worktrees is using an automated process that identifies stale candidates and runs git worktree prune. This ensures related branches are cleaned up safely during routine maintenance.

Can I do a dry-run before removing git worktrees to avoid losing changes?

Yes, you can use a dry-run mode to preview stale worktree removal before executing. This safety check prevents accidental data loss by identifying finished or abandoned branches without deleting them.

Does git worktree cleanup work with remote branch deletions and merged PRs?

Yes, git worktree cleanup supports workflows involving merged PRs and remote branch deletions. It identifies stale worktrees based on merge status and recent activity to maintain a clean local development environment.

What are the limitations of aggressive mode when cleaning up git worktrees?

Aggressive mode removes stale worktrees with fewer safety checks, increasing the risk of deleting recently active branches. Use safe mode or dry-run if you need to preserve potentially unfinished work during repository maintenance.

Why do unused git worktrees accumulate and cause repository clutter?

Unused git worktrees accumulate when branches are merged or abandoned without removing the associated working directories. This causes repository clutter and consumes disk space until routine maintenance prunes them.