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.