clean-gone

Identify and remove local git branches deleted from the remote, including worktrees.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/KosmoCHE/claude-plugins --skill clean-gone-kosmoche
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-gone
Source: https://github.com/KosmoCHE/claude-plugins/tree/main/git-command/skills/clean-gone
Command: npx skills add https://github.com/KosmoCHE/claude-plugins --skill clean-gone-kosmoche

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean up local branches that have been deleted from the remote and their linked worktrees to keep the repository tidy.

Core Features & Use Cases

  • Identify remote-tracking branches marked as [gone] after fetching with prune.
  • Remove associated worktrees before deleting local branches.
  • Provide safe reporting when no cleanup is needed in a repository.

Quick Start

Run the steps to prune remote-tracking data, identify [gone] branches, remove their worktrees, and delete the branches locally.

Frequently Asked Questions about clean-gone

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

FAQPage Schema
How do I delete local git branches that are gone from the remote?

Yes, this process removes associated worktrees before deleting local git branches. It identifies remote-tracking branches marked as [gone] after fetching with prune, ensuring safe removal of both the worktree and the branch.

How does git prune work for stale branches and worktrees?

Git prune for stale branches works by fetching remote updates, identifying local branches marked as [gone], removing their linked worktrees, and safely deleting the local branches. This enforces deterministic Git operations for accurate local branch sets.

Do I need to manually remove worktrees before deleting stale git branches?

No, you do not need to manually remove worktrees before deleting stale git branches. The cleanup process automatically handles branches with and without worktrees, pruning safely before deletion to ensure a clean and accurate local branch set.

What happens if there are no stale branches to clean up in my repository?

If there are no stale branches to clean up in your repository, the process provides safe reporting indicating no cleanup is needed. This ensures deterministic Git operations without making unnecessary changes to your local branch set.

Can I automate branch cleanup for repositories with many deleted remote branches?

Yes, you can automate branch cleanup for repositories with deleted remote branches. The process identifies remote-tracking branches marked as [gone] after fetching with prune, handles worktree removal, and deletes stale local branches deterministically.