worktree-cleanup

Remove merged git worktrees with no uncommitted changes from .claude/worktrees/ and .worktrees/.

6|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/anotherben/claude-harness --skill worktree-cleanup-anotherben
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-cleanup
Source: https://github.com/anotherben/claude-harness/tree/main/skills/worktree-cleanup
Command: npx skills add https://github.com/anotherben/claude-harness --skill worktree-cleanup-anotherben

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Worktrees clutter repositories, waste disk space, and create confusion about which branch is active or up to date. This skill provides a safe, repeatable process to identify and remove stale or merged worktrees without impacting active development.

Core Features & Use Cases

  • Audit all local worktrees across .claude/worktrees/ and .worktrees/.
  • Classify worktrees as Safe to remove, Active, Stale, or Orphaned, and guide user decisions.
  • Step-by-step removal with safeguards, including updates to MEMORY.md resume points.

Quick Start

Audit and clean up worktrees that are stale or merged to the main development branch.

Frequently Asked Questions about worktree-cleanup

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

FAQPage Schema
How do I safely clean up unused git worktrees without losing uncommitted changes?

To safely clean up git worktrees, audit directories like .claude/worktrees/ and .worktrees/ to classify worktrees as Safe to remove, Active, Stale, or Orphaned. Safeguards ensure only worktrees merged to dev with no uncommitted changes are deleted, prompting for ambiguous cases.

What is the best way to prune stale git worktrees and reclaim disk space?

Pruning stale git worktrees involves auditing local worktree directories, classifying their status, and removing those merged to the main development branch. This reclaims wasted disk space and reduces repository confusion while preserving active development branches.

When should I remove merged git worktrees from my repository?

You should remove merged git worktrees when starting a new feature, when MEMORY.md references multiple worktrees, or when you request cleanup. This prevents stale worktrees from cluttering the repository and confusing branch tracking.

Can I delete orphaned git worktrees if they are not merged to the dev branch?

Deleting orphaned git worktrees not merged to dev triggers user prompts for ambiguous cases. The safe removal process enforces safeguards by only automatically deleting worktrees that are fully merged and have no uncommitted changes, requiring confirmation otherwise.

Does cleaning up git worktrees update my MEMORY.md resume points?

Yes, the git worktree cleanup process includes step-by-step removal with safeguards that update MEMORY.md resume points. This ensures your branch tracking and memory references remain accurate after stale or merged worktrees are deleted.