git-worktree-tidy

Clean stale Git worktrees and delete orphaned local branches.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates routine maintenance for repositories that use a bare repository with multiple linked worktrees by fetching updates, pruning remote-tracking refs, identifying gone-upstream branches, and safely removing stale or orphaned worktrees while preserving uncommitted work.

Core Features & Use Cases

  • Fetch and prune: Fetches from origin with pruning and reports deleted remote-tracking refs and updated refs.
  • Discover stale branches and worktrees: Detects local branches whose upstream is gone and enumerates worktrees that are clean, dirty, or have prunable metadata.
  • Safe deletion and confirmations: Presents a full summary of stale worktrees, branches, and metadata and requires explicit user confirmation before any destructive action; flags dirty worktrees separately.
  • Fast-forward important branches: Identifies dedicated worktrees for main, dev, or user-specified branches and attempts pull --ff-only, reporting divergences for user guidance.
  • Use Case: Clean up a developer workstation hosting many feature worktrees to reclaim disk space, remove orphaned refs, and fast-forward stable branches.

Quick Start

Run the git-worktree-tidy routine to fetch and prune origin, identify stale worktrees and branches, and prompt me to confirm deletions and fast-forward updates.

Frequently Asked Questions about git-worktree-tidy

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

FAQPage Schema
How do I clean up stale Git worktrees and orphaned local branches?▼

This Skill cleans stale Git worktrees and orphaned local branches by operating from your bare repository directory to fetch updates, prune remote-tracking refs, and list dirty or prunable metadata for explicit user confirmation before deletion.

What is the best way to fast-forward Git worktree branches without losing uncommitted work?▼

The best way to fast-forward Git worktree branches without losing uncommitted work is to attempt pull --ff-only on dedicated worktrees for main or dev, flagging dirty worktrees separately and reporting divergences to preserve uncommitted work.

Does Git worktree cleanup work with bare repositories?▼

Yes, Git worktree cleanup works with bare repositories by operating directly from the bare directory to discover prunable worktrees and detect branches whose upstream is gone before requiring explicit confirmation for any deletions.

How do I detect which Git worktrees are dirty or have prunable metadata?▼

You can detect dirty or prunable Git worktrees by running a repository maintenance routine that enumerates all linked worktrees, classifies them by status, and presents a full summary of prunable metadata for user review before action.

Why do I need to confirm deletions when pruning Git worktrees?▼

You need to confirm deletions when pruning Git worktrees because the routine requires explicit user confirmation before destructive actions, flagging dirty worktrees separately to prevent removing worktrees with uncommitted work.