prune-worktrees

Detect merged and stale Git worktrees and remove them with Worktrunk.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/RagnarokButMemorySafe/opencode-config --skill prune-worktrees
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prune-worktrees
Source: https://github.com/RagnarokButMemorySafe/opencode-config/tree/main/skills/prune-worktrees
Command: npx skills add https://github.com/RagnarokButMemorySafe/opencode-config --skill prune-worktrees

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill automates the process of identifying and removing merged or stale Git worktrees, helping to keep your repository clean and organized.

Core Features & Use Cases

  • Automated Detection: Identifies worktrees that are no longer needed based on their merge status and remote synchronization.
  • Safe Removal: Uses Worktrunk's wt remove command to safely delete worktrees and associated branches.
  • Use Case: After merging several feature branches, you can use this Skill to automatically clean up the corresponding worktrees, preventing clutter and potential confusion.

Quick Start

Run the prune-worktrees skill to clean up any merged or stale Git worktrees.

Frequently Asked Questions about prune-worktrees

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

FAQPage Schema
How do I clean up stale Git worktrees after merging branches?

To clean up stale Git worktrees, this Skill automates the detection and removal of merged, clean, and synced branches using Worktrunk. It safely deletes outdated development worktrees to prevent repository clutter after feature merges.

What is the safest way to prune Git worktrees without losing uncommitted changes?

Pruning Git worktrees safely requires checking merge status and remote synchronization. This Skill uses Worktrunk to verify branches are merged and synced before removal, ensuring uncommitted local changes are not lost during cleanup.

How do I automate Git worktree lifecycle management in my local repository?

Automating Git worktree lifecycle management involves detecting outdated branches and executing safe removal commands. This Skill uses Worktrunk to identify merged worktrees and runs the removal process automatically to maintain repository hygiene.

Does Git worktree cleanup work automatically with the Worktrunk tool?

Yes, Git worktree cleanup works automatically with the Worktrunk tool. The Skill leverages the `wt remove` command to identify and safely delete worktrees associated with merged or fully synced branches without manual intervention.

When should I remove old Git worktrees instead of just deleting the branch?

You should remove old Git worktrees when branches are merged and synced to prevent stale working directories from cluttering your repository. Simply deleting a branch leaves the associated worktree directory behind, requiring separate cleanup.