worktree-janitor

Audit and prune stale git worktrees safely across repositories.

5|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/gabrielkoerich/skills --skill worktree-janitor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-janitor
Source: https://github.com/gabrielkoerich/skills/tree/main/worktree-janitor
Command: npx skills add https://github.com/gabrielkoerich/skills --skill worktree-janitor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Audit and clean git worktrees safely across repositories, including stale metadata and merged local branches.

Core Features & Use Cases

  • List all worktrees in a repository and identify merged or unused entries.
  • Audit local branches that are fully merged and eligible for cleanup without risking work in progress.
  • Use a safe, guarded workflow to prune metadata and remove unused worktrees across multiple repos.

Quick Start

Run the janitor script with audit to review worktrees, then prune safely after confirming results.

Frequently Asked Questions about worktree-janitor

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

FAQPage Schema
How do I safely prune git worktrees in a repository?

Run the janitor script to perform a safe prune of git worktrees by auditing merged local branches and stale metadata. Confirm the audit results before executing guarded removal commands that protect your current worktree from deletion.

What is the best way to audit git worktrees across multiple repos?

Use a deterministic, script-based workflow to audit git worktrees across multiple repositories, identifying merged or unused entries and stale metadata. This provides clear safety checks to review eligibility before any cleanup actions are taken.

Can I clean up stale git worktree metadata without affecting my current work?

Yes, you can safely clean stale git worktree metadata without affecting current work by using a guarded prune workflow. Built-in safety guardrails protect the active worktree while removing only stale entries and fully merged local branches.

How do I identify merged local branches eligible for git worktree cleanup?

Run an audit command to identify merged local branches eligible for git worktree cleanup by checking branch metadata and flagging fully merged branches as safe for removal. This prevents accidental deletion of branches with work in progress.

What should I do before removing unused git worktrees?

Before removing unused git worktrees, run an audit to review all entries and verify which worktrees are stale or merged. Always confirm the audit results to ensure no active work is lost before executing the prune workflow.

When should I not use a script to clean up git worktrees?

You should not use a script to clean up git worktrees when you have uncommitted changes in an unused worktree, as automated audits may not detect them. Always manually verify work in progress before running any prune or remove commands.