git-worktree-clean

Clean stale git worktrees and merged branches with protected branch safeguards.

Updated May 30, 2026
One-click install
npx skills add https://github.com/alexica00/claude-code-ultimate-guide --skill git-worktree-clean-alexica00
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree-clean
Source: https://github.com/alexica00/claude-code-ultimate-guide/tree/main/examples/skills/git-worktree-clean
Command: npx skills add https://github.com/alexica00/claude-code-ultimate-guide --skill git-worktree-clean-alexica00

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Batch-clean stale git worktrees, optimize disk usage, and safeguard merged worktrees while prompting review for unmerged ones.

Core Features & Use Cases

  • Auto-clean merged worktrees to keep the repository lean.
  • Interactive review for unmerged worktrees to prevent accidental deletions.
  • Disk usage reporting to quantify reclaimed space and identify large worktrees.

Quick Start

Run the git-worktree-clean command to remove merged worktrees and report the reclaimed space.

Frequently Asked Questions about git-worktree-clean

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?

To clean up stale git worktrees and reclaim disk space, you can automate the removal of merged worktrees while safely prompting for review on unmerged ones. This process keeps your repository lean and reports the exact amount of space reclaimed.

What is the safest way to remove unmerged git worktrees without losing changes?

The safest way to remove unmerged git worktrees is using an interactive review process that prompts for decisions on each item. This prevents accidental deletions by distinguishing between merged and unmerged states before any removal occurs.

Can I automate git branch management to auto-clean merged worktrees?

Yes, you can automate git branch management to auto-clean merged worktrees. The automation safely removes merged branches in auto mode while strictly honoring protected branches to prevent critical data loss.

How does git worktree cleanup handle protected branches during automated removal?

Git worktree cleanup handles protected branches by explicitly honoring them during automated removal. It ensures safe removal by skipping protected branches and only targeting stale worktrees and merged branches for deletion.

Why does git worktree disk usage keep growing and how can I report reclaimed space?

Git worktree disk usage grows because stale worktrees and merged branches accumulate over time. You can report reclaimed space by running an automated cleanup that identifies large worktrees and quantifies the exact disk space freed.