worktree-prune

Prune stale git worktrees and agent-spawned branches with dry-run reporting.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/lasswellt/blitz-cc --skill worktree-prune
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-prune
Source: https://github.com/lasswellt/blitz-cc/tree/main/skills/worktree-prune
Command: npx skills add https://github.com/lasswellt/blitz-cc --skill worktree-prune

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Blitz development workflows generate numerous temporary git worktrees and agent-spawned branches that accumulate over time, consuming disk space and cluttering the repository. Manual cleanup risks deleting active work, unmerged branches, or worktrees owned by live background sessions, leading to irreversible data loss.

Core Features & Use Cases

  • Dry-run inventory by default: Reports age, merge status, commit divergence, and disk usage for all matching worktrees and branches without making any changes.
  • Safe merged deletion: Use the --apply --merged-only flag to delete only fully merged branches and their associated worktrees, with no risk to unmerged work.
  • Live session protection: Automatically skips worktrees owned by active Claude Code background sessions to prevent data loss, even when using the --force flag.
  • Use case: After completing a blitz sprint, use this skill to clean up leftover sprint-N/role branches and agent worktrees without risking active development work.

Quick Start

Use the worktree-prune skill to list all stale git worktrees and branches with their age, merge status, and reclaimable disk space.

Frequently Asked Questions about worktree-prune

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

FAQPage Schema
How do I safely clean up stale git worktrees after a sprint?

To safely clean up stale git worktrees, run a dry-run inventory first to report age, merge status, and disk usage. Then apply deletion logic that enforces merge checks and protects live background sessions.

What happens if I delete unmerged git branches during repository maintenance?

Deleting unmerged git branches during repository maintenance risks irreversible data loss. You can avoid this by using a merged-only deletion flag to ensure only fully merged branches and their associated worktrees are removed.

How does git worktree cleanup handle active Claude Code background sessions?

Git worktree cleanup automatically skips worktrees owned by active Claude Code background sessions to prevent data loss, ensuring live development work remains protected even when a force flag is applied.

Can I reclaim disk space from agent-spawned branches without risking active work?

Yes, you can reclaim disk space from agent-spawned branches by running a dry-run report to view reclaimable space, then applying merged-only deletion to safely eliminate accumulated worktrees without risking active work.

Does worktree-prune work with Vue and Nuxt repositories using the blitz-cc plugin?

Yes, worktree-prune is designed for Vue/Nuxt and Firebase projects using the blitz-cc plugin, specifically targeting the agent-spawned branches and temporary git worktrees generated by blitz development workflows.

What is the best way to remove temporary git worktrees left from aborted development sessions?

The best way to remove temporary git worktrees from aborted sessions is to use guarded cleanup logic that provides dry-run reporting, enforces merge status checks, and protects live background session worktrees from accidental deletion.