cleanup

Remove orphaned git worktrees and stale local branches with approval.

Updated Feb 7, 2026
One-click install
npx skills add https://github.com/thisolivier/chronolog --skill cleanup-thisolivier
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup
Source: https://github.com/thisolivier/chronolog/tree/main/.claude/skills/cleanup
Command: npx skills add https://github.com/thisolivier/chronolog --skill cleanup-thisolivier

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, gh.

What problem does it solve?

It helps you identify and remove stale git branches and orphaned worktrees that clutter your repository and waste review and build time.

Core Features & Use Cases

  • Worktree and branch inventory: Scans current worktrees, branch recency, merged status into main, and tracking relationships to the remote.
  • Safety-first cleanup planning: Separates removals into safe (merged into main) and requires confirmation (unmerged or potentially risky items).
  • GitHub PR awareness: Uses GitHub PR state to help decide whether branches are truly stale (e.g., closed/merged vs. still active).

Quick Start

Ask the cleanup skill to analyze your repository and propose what can be safely deleted, then approve only the items you want removed.

Frequently Asked Questions about cleanup

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

FAQPage Schema
How do I clean up stale git branches and orphaned worktrees in my repository?

To clean up stale git branches and orphaned worktrees, you can scan your repository for merged, outdated, or untracked branches and worktrees, then approve prune and delete operations to reduce clutter. The process generates an auditable report before removing anything.

What is the safest way to remove local git branches that are no longer needed?

The safest way to remove local git branches involves separating deletions into safe categories like merged branches, and those requiring confirmation like unmerged branches. Guardrails prevent deleting the current branch or main and master, ensuring protected refs remain intact.

How does GitHub PR status help determine if a branch is stale?

GitHub PR status helps determine if a branch is stale by checking whether associated pull requests are closed or merged versus still active. This prevents removing branches that are actively reviewed or pending merge, adding an extra layer of safety to the cleanup process.

Do I need both git and gh installed to prune stale branches and worktrees?

Yes, you need both git and gh installed to prune stale branches and worktrees using this approach. The git dependency handles local state-gathering and worktree management, while gh queries GitHub for pull request states to verify branch staleness accurately.

What happens to orphaned git worktrees left behind after branch deletions or ref moves?

Orphaned git worktrees left behind after deletions or ref moves are identified during the repository scan and included in the cleanup report. You can then approve their removal to prevent outdated refs from accumulating and wasting build time.

Can I review what will be deleted before executing git worktree and branch cleanup?

Yes, you can review what will be deleted before executing cleanup because the tool produces an auditable report separating safe removals from risky ones. You approve only the specific items you want removed, ensuring no unexpected deletions occur.