worktree-safe-remove

Validate local data before removing a worktree with a wrapper script.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/barikata1984/.agent --skill worktree-safe-remove
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-safe-remove
Source: https://github.com/barikata1984/.agent/tree/main/skills/worktree-safe-remove
Command: npx skills add https://github.com/barikata1984/.agent --skill worktree-safe-remove

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Safely delete a worktree by validating the presence of important data in data/local before deletion, while keeping data/shared intact via the main repository symlink.

Core Features & Use Cases

  • Check data/local for critical files before removing a worktree.
  • Warn users about potential data loss and offer safe alternatives.
  • Preserve data/shared via symlink to the main repository across all worktrees.

Quick Start

Run the safe-remove wrapper with the target worktree path to safely delete that worktree.

Frequently Asked Questions about worktree-safe-remove

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

FAQPage Schema
How do I safely remove a git worktree without losing local data?

To safely remove a git worktree, validate the data/local directory for critical files before deletion. This process checks for important information and prompts for confirmation to prevent losing local data during the removal.

What happens to shared data when deleting a worktree?

When deleting a worktree, shared data remains intact because data/shared is preserved via a symlink to the main repository. This ensures that information shared across all worktrees is not lost during the deletion of individual worktrees.

How do I check for critical files before pruning a worktree?

Checking for critical files before pruning a worktree involves scanning the data/local directory. A wrapper script performs validation checks, issues warnings if local data exists, and requests user confirmation to execute the deletion safely.

Can I prevent accidental data loss when working with multiple worktrees?

You can prevent accidental data loss across multiple worktrees by using a safe-remove wrapper script. It validates local data, prompts for confirmation, and preserves shared data via the main repository symlink before any deletion occurs.

What is the best way to delete a worktree that contains uncommitted local changes?

The best way to delete a worktree with local changes is to use a safe-remove wrapper that scans data/local for critical files. It warns you about potential data loss and offers safe alternatives before executing the deletion while maintaining safety rails.