worktree-delete

Remove git worktrees and optionally delete associated branches.

39|6|Updated Jan 5, 2026
One-click install
npx skills add https://github.com/the-agency-ai/the-agency --skill worktree-delete
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-delete
Source: https://github.com/the-agency-ai/the-agency/tree/main/.claude/skills/worktree-delete
Command: npx skills add https://github.com/the-agency-ai/the-agency --skill worktree-delete

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the process of removing git worktrees and managing associated branches, reducing manual errors and saving time.

Core Features & Use Cases

  • Worktree Removal: Safely deletes specified git worktrees from the repository.
  • Branch Management: Offers options to delete or keep the associated branch after worktree removal.
  • Use Case: If a developer needs to clean up old feature branches and their worktrees, this Skill automates the process, ensuring repository integrity with minimal input.

Quick Start

Use the worktree-delete skill to remove a worktree named 'feature-x' and delete its branch if desired.

Frequently Asked Questions about worktree-delete

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

FAQPage Schema
How do I safely delete a git worktree and its branch?

A git worktree can be removed safely by verifying worktree existence, checking for uncommitted changes, and pruning references. Automating this process ensures repository consistency and reduces manual branch cleanup errors in collaborative environments.

What happens to the branch when I remove a git worktree?

When removing a git worktree, you can choose to delete or keep the associated branch. This branch management option allows you to clean up old feature branches while maintaining repository integrity based on your version-control needs.

Can I clean up multiple git worktrees in a collaborative development environment?

Yes, you can clean up multiple git worktrees in collaborative development environments. The process manages repository consistency by verifying worktree existence and pruning references, making it suitable for handling multiple worktrees simultaneously.

Why does git worktree removal fail with uncommitted changes?

Git worktree removal may fail if there are uncommitted changes in the working directory. The process checks for uncommitted changes before proceeding with worktree removal and branch cleanup to prevent data loss and maintain repository consistency.

What's the best way to automate git branch cleanup after feature development?

The best way to automate git branch cleanup is by using a process that removes the git worktree and optionally deletes its associated branch. This ensures repository integrity with minimal manual input, reducing errors during version-control management.