tidying-worktrees

Remove spent git worktrees across the fleet with a dry-run default.

125|42|Updated May 19, 2025
One-click install
npx skills add https://github.com/SocketDev/socket-mcp --skill tidying-worktrees
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tidying-worktrees
Source: https://github.com/SocketDev/socket-mcp/tree/main/.claude/skills/fleet/tidying-worktrees
Command: npx skills add https://github.com/SocketDev/socket-mcp --skill tidying-worktrees

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Sweep and prune spent git worktrees across the fleet, removing only those that are fully merged or no longer present on the remote, thereby reclaiming space and reducing clutter without disrupting active work.

Core Features & Use Cases

  • Fleet-wide cleanup: safely removes obsolete worktrees across multiple repos with a conservative, no-prompt policy.
  • Safety-first: preserves worktrees that are dirty, ahead of base, or still linked to active remotes to prevent data loss.
  • Maintenance-ready: designed for periodic care (e.g., loop runs) and pre-cascade housekeeping to ensure a clean fleet state.

Quick Start

Instruct the AI to run the tidying-worktrees sweep in dry-run mode to identify removable worktrees across the fleet.

Frequently Asked Questions about tidying-worktrees

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

FAQPage Schema
How do I safely clean up git worktrees across multiple repos without losing unpushed commits?

Fleet-wide git worktree cleanup removes only worktrees that are fully merged into the base branch or gone from the remote. It preserves dirty worktrees and those with unpushed commits, running a dry-run by default to ensure no active work is lost.

What is the best way to prune obsolete git worktrees before a cascade update?

Pruning obsolete git worktrees before a cascade involves scanning repos fleet-wide and applying a conservative removal contract. This safely deletes only clean, fully merged worktrees while requiring no prompts, reducing clutter without disrupting active development.

Does git worktree cleanup protect branches that are ahead of the base or still linked to active remotes?

Yes, worktree cleanup enforces a strict removability contract that protects branches ahead of base or linked to active remotes. It only deletes clean worktrees that are fully merged into origin or no longer present on the remote.

Can I run a worktree maintenance sweep in dry-run mode first?

Yes, the worktree maintenance sweep defaults to a dry-run before making any changes. This allows you to identify removable worktrees across the fleet safely and confirm no active worktrees will be deleted before executing actual removals.

When should I not use automated worktree removal?

You should avoid automated worktree removal on branches with unpushed commits, dirty working directories, or worktrees still linked to active remotes. The removability contract specifically protects these active states to prevent data loss during fleet maintenance.