git-worktree

Remove merged git worktrees and prune associated local branches.

2|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/erclx/aitk --skill git-worktree-erclx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/erclx/aitk/tree/main/claude/skills/git-worktree
Command: npx skills add https://github.com/erclx/aitk --skill git-worktree-erclx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the accumulation of abandoned git worktrees and orphaned local branches that clutter your development environment and lead to stale state.

Core Features & Use Cases

  • Worktree Enumeration: Lists all linked worktrees with their associated branch, PR status, and dirtiness.
  • Automated Cleanup: Safely removes merged worktrees and prunes their corresponding local branches in one operation.
  • Use Case: After shipping multiple pull requests, use this skill to reclaim disk space and clean up your local repository state by removing all worktrees that have already been merged into the main branch.

Quick Start

Ask the assistant to clean up all merged worktrees to reclaim your development slots.

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I clean up merged git worktrees and orphaned local branches?

To clean up merged git worktrees, you can automate the removal of associated directories and prune their corresponding local branches in one operation. This ensures your local repository state stays synchronized with remote pull request statuses.

What is the best way to remove abandoned git worktrees after shipping pull requests?

The best way to remove abandoned git worktrees is to identify branches that have been merged and safely delete their linked directories. This process reclaims disk space and eliminates stale state from your development environment.

Do I need GitHub CLI to verify pull request status before deleting worktrees?

Yes, you need GitHub CLI to verify pull request state before deleting worktrees. This ensures safe cleanup by confirming that the associated branches are actually merged and that the worktrees are not dirty.

Can I list all linked git worktrees along with their branch and dirtiness status?

Yes, you can list all linked git worktrees to view their associated branch, PR status, and dirtiness. This worktree enumeration helps you audit your local repository state before performing any automated cleanup.

Why does git worktree cleanup require checking for non-dirty and merged branches?

Git worktree cleanup requires checking for non-dirty and merged branches to prevent data loss. Synchronizing local worktree state with remote branch ancestry ensures that only safe, fully merged worktrees are removed.