git-worktree-cleanup

Remove Git worktree directories and associated feature branches.

Updated Jul 7, 2026
One-click install
npx skills add https://github.com/eavichay/mycli --skill git-worktree-cleanup-eavichay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree-cleanup
Source: https://github.com/eavichay/mycli/tree/main/.cursor/skills/git-worktree-cleanup
Command: npx skills add https://github.com/eavichay/mycli --skill git-worktree-cleanup-eavichay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill resolves the clutter of abandoned Git worktrees and stale feature branches, ensuring your repository remains clean and organized without manual cleanup errors.

Core Features & Use Cases

  • Idempotent Cleanup: Safely removes worktree directories regardless of their current state.
  • Branch Management: Optionally deletes the associated feature branch in a single operation.
  • Safety Guardrails: Prevents accidental deletion of worktrees containing uncommitted changes or missing manifests.

Quick Start

Use the git-worktree-cleanup skill to remove the worktree for feature 003-user-auth and delete its branch.

Frequently Asked Questions about git-worktree-cleanup

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

FAQPage Schema
How do I safely remove Git worktrees and delete their associated branches?

To safely remove Git worktrees and branches, you can automate the disposal process using manifest-based safety validation. This ensures worktree directories and their feature branches are pruned idempotently without manual cleanup errors.

What is the best way to clean up abandoned Git worktrees in my repository?

The best way to clean up abandoned Git worktrees is through an automated pruning process that checks for uncommitted changes or missing manifests. This prevents accidental data loss while systematically removing stale directories.

Can I delete a Git feature branch and its worktree directory at the same time?

Yes, you can delete a Git feature branch and its worktree directory simultaneously. The cleanup process manages branch removal in a single operation to ensure your repository remains organized after feature testing concludes.

Does Git worktree cleanup work if the worktree directory has uncommitted changes?

Git worktree cleanup includes safety guardrails that prevent deletion when a worktree contains uncommitted changes or missing manifests. This validation protocol ensures you do not accidentally lose uncommitted work during the disposal process.

Do I need Git installed to automate worktree and branch removal?

Yes, you need Git installed to automate worktree and branch removal. The cleanup process requires Git availability to execute the underlying commands that prune directories and delete associated feature branches safely.

Why should I use automated pruning for Git worktrees instead of manual deletion?

Automated pruning for Git worktrees prevents manual cleanup errors by applying idempotent removal and manifest-based safety validation. It safely removes directories regardless of their current state, ensuring your repository stays clean without operational risk.