git-clean-gone-branches

Prune local Git branches whose remote tracking branches are gone.

Updated Sep 16, 2025
One-click install
npx skills add https://github.com/mukles/platejs-markdown-converter --skill git-clean-gone-branches-mukles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-clean-gone-branches
Source: https://github.com/mukles/platejs-markdown-converter/tree/main/.agents/skills/git-clean-gone-branches
Command: npx skills add https://github.com/mukles/platejs-markdown-converter --skill git-clean-gone-branches-mukles

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill removes local Git branches whose remote tracking branch has been deleted, including any related worktrees.

Core Features & Use Cases

  • Discover gone branches by running the discovery script to fetch the latest remote state and identify branches marked as gone.
  • Present the list of stale branches to the user for confirmation and delete them upon approval.
  • Safely remove associated worktrees before deleting branches to avoid orphaned references.

Quick Start

Run the cleanup workflow to remove local branches whose remote tracking branches no longer exist.

Frequently Asked Questions about git-clean-gone-branches

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

FAQPage Schema
How do I delete local Git branches whose remote has been deleted?

To delete local Git branches whose remote has been deleted, this Skill runs git fetch --prune to refresh state and uses git branch -vv to identify gone entries, then removes them after user approval.

Can I clean up stale local branches that use Git worktrees?

Yes, you can clean up stale local branches using Git worktrees. The Skill safely removes associated worktrees before deleting the branches to prevent orphaned references in your repository.

What is the best way to automatically prune gone branches in a Git repository?

The best way to automatically prune gone branches is running a cleanup workflow that fetches the latest remote state, identifies stale branches marked as gone, and deletes them following a user confirmation step.

Does the branch cleanup process require confirmation before deleting?

Yes, the branch cleanup process requires confirmation. The Skill presents the discovered list of stale branches to the user and only proceeds with deletions after receiving explicit approval.

Why does git fetch --prune leave orphaned local branches behind?

Git fetch --prune leaves orphaned local branches behind because it only removes remote tracking references. You need a separate branch cleanup process to identify gone entries and delete the local branches.

How do I find which local branches have gone remote tracking entries?

To find which local branches have gone remote tracking entries, the Skill runs git branch -vv after refreshing the remote state, identifying branches marked as gone for targeted removal.