clean-gone

Remove local Git branches deleted from the remote, including associated worktrees.

Updated Jan 22, 2026
One-click install
npx skills add https://github.com/dtbuchholz/claude-config --skill clean-gone-dtbuchholz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-gone
Source: https://github.com/dtbuchholz/claude-config/tree/main/skills/clean-gone
Command: npx skills add https://github.com/dtbuchholz/claude-config --skill clean-gone-dtbuchholz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps maintain a clean local Git repository by automatically identifying and removing local branches that have already been deleted from the remote, along with any associated worktrees.

Core Features & Use Cases

  • Automated Branch Cleanup: Fetches remote changes and prunes stale branches.
  • Worktree Management: Detects and removes worktrees linked to gone branches before deleting the branch.
  • Use Case: After a feature branch has been merged and deleted on GitHub, this skill can be used to clean up the local copy of that branch and its associated worktree, preventing clutter.

Quick Start

Run the clean gone branches skill to remove local branches that no longer exist on the remote.

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 have been removed from the remote repository?

To delete local git branches removed from the remote, you can use a cleanup skill that fetches remote changes, prunes stale branches, and deletes the corresponding local branches. This keeps your repository free of merged feature branches that no longer exist upstream.

Can I remove git worktrees associated with branches that are already deleted on the remote?

Yes, removing git worktrees associated with gone branches is supported. The cleanup process detects worktrees linked to deleted remote branches and removes them before deleting the local branch itself, preventing orphaned worktree clutter.

What is the best way to clean up stale git branches and worktrees after merging a feature?

The best way to clean up stale git branches after a feature merge is to automate the fetch and prune process. This identifies local branches without a remote counterpart and deletes them along with their associated worktrees, streamlining developer workflow optimization.

Do I need Git command-line tools to prune local branches and worktrees automatically?

Yes, you need Git command-line tools to prune local branches and worktrees automatically. The cleanup process relies on Git CLI commands to fetch remote updates, list branches, manage worktrees, and delete the local copies that no longer exist on the remote.

Why does my local git repository still show branches that were deleted on GitHub?

Your local git repository still shows branches deleted on GitHub because your local copy does not automatically sync remote deletions. Running a fetch with a prune operation is required to identify and clean up these stale local branches and their worktrees.

Are there limitations to automatically cleaning up stale git worktrees and branches?

The primary limitation when cleaning up stale git worktrees and branches is that the process targets branches explicitly deleted from the remote. It requires a valid remote connection and will not remove local branches that have not been merged and deleted upstream.