worktree-cleanup

Remove a stale git worktree and its associated local branch.

71|14|Updated Jun 26, 2025
One-click install
npx skills add https://github.com/Synaptic-Labs-AI/PACT-Plugin --skill worktree-cleanup-synaptic-labs-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-cleanup
Source: https://github.com/Synaptic-Labs-AI/PACT-Plugin/tree/main/pact-plugin/skills/worktree-cleanup
Command: npx skills add https://github.com/Synaptic-Labs-AI/PACT-Plugin --skill worktree-cleanup-synaptic-labs-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Remove a git worktree and its associated branch after a PACT workflow completes to keep the repository clean and avoid stale references.

Core Features & Use Cases

  • Deterministic cleanup: Remove a selected worktree and its local branch in a controlled sequence.
  • Post-merge hygiene: Ideal after PR merges or CONSOLIDATE steps to tidy up sub-worktrees.
  • Manual cleanup support: Useful for ad-hoc cleanups with clear error messages and safety checks.

Quick Start

Provide the target worktree path and confirm the cleanup operation.

Frequently Asked Questions about worktree-cleanup

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

FAQPage Schema
How do I safely remove a git worktree and its local branch after a merge?

To remove a git worktree and its local branch safely, the Skill verifies the repository root, executes worktree removal, and deletes the branch in a deterministic sequence with clear error messages.

What is the best way to clean up stale git worktrees in my repository?

Cleaning up stale git worktrees is handled by identifying the target path and removing the worktree alongside its associated branch, ensuring repository hygiene after PACT workflows or PR merges.

How does git worktree cleanup work for consolidated sub-worktrees?

Git worktree cleanup for consolidated sub-worktrees works by applying safe, deterministic steps to verify the repository root, remove the specific target worktree, and delete its local branch.

Can I manually delete a git worktree without losing unmerged branch data?

Manual git worktree deletion includes safety checks and clear error messages to prevent data loss, verifying the repository root before removing the target worktree and deleting its associated branch.

When do I need to remove a git worktree during my workflow?

You need to remove a git worktree when a PACT workflow completes, after PR merges, or during ad-hoc manual cleanup to tidy up sub-worktrees and avoid stale references in your repository.

Why does my git worktree removal fail with a repository root error?

Git worktree removal fails with a repository root error when the safety checks cannot verify the target path, prompting clear error messages to ensure deterministic and safe cleanup execution.