cleanup-worktrees

Prune stale git worktrees and merged local branches via Bash.

12|1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/Space-Dinosaurs/DinoStack --skill cleanup-worktrees-space-dinosaurs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-worktrees
Source: https://github.com/Space-Dinosaurs/DinoStack/tree/main/.openclaw/skills/cleanup-worktrees
Command: npx skills add https://github.com/Space-Dinosaurs/DinoStack --skill cleanup-worktrees-space-dinosaurs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean up stale git worktrees and local branches in the current repository. This Skill reduces clutter and confusion after task completion by removing obsolete worktrees and pruning unnecessary branches.

Core Features & Use Cases

  • Remove isolated agent worktrees created for testing or experiments.
  • Prune feature branches that have been merged or abandoned, reducing local branch noise.
  • Provide a safe, stepwise workflow with clear status reporting and recovery notes for offline or remote environments.

Quick Start

Prune stale worktrees and prune unused local branches in the current repository.

Frequently Asked Questions about cleanup-worktrees

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

FAQPage Schema
How do I prune stale git worktrees safely?

This Skill cleans up stale git worktrees safely by executing a stepwise workflow that skips non-existent or dirty entries, only removing those associated with merged PRs to prevent data loss.

What is the best way to clean up local git branches after a merge?

Cleaning up local git branches after a merge is handled by pruning feature branches that have been merged or abandoned, reducing local branch noise and repository clutter.

Does cleaning up git worktrees skip branches with uncommitted changes?

Yes, cleaning up git worktrees safely skips dirty worktrees with uncommitted changes. It skips non-existent or dirty worktrees and provides recovery notes for offline environments.

When should I remove isolated agent worktrees from my repository?

Remove isolated agent worktrees from your repository after task completion or branch churn, such as following merges, to reduce clutter and confusion from obsolete worktrees and branches.

Can I prune unused local branches in repositories with multiple feature branches?

Yes, you can prune unused local branches in repositories with multiple feature branches and agent worktrees, clearing obsolete entries after merges or branch churn.