git-clean-gone-branches

Prune local Git branches with deleted remote tracking branches after user confirmation.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/Andreicr1/netz-analysis-engine --skill git-clean-gone-branches-andreicr1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-clean-gone-branches
Source: https://github.com/Andreicr1/netz-analysis-engine/tree/main/.gemini/skills/git-clean-gone-branches
Command: npx skills add https://github.com/Andreicr1/netz-analysis-engine --skill git-clean-gone-branches-andreicr1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Local development teams often accumulate stale local branches whose remote tracking branches have been deleted, leading to a cluttered workspace and confusion.

Core Features & Use Cases

  • Discovers local branches that are gone from the remote by fetching and inspecting git branch -vv output.
  • Presents the list for user confirmation and safely deletes them, cleaning up any associated worktrees.
  • Skips the currently checked-out branch and handles worktrees to avoid data loss.

Quick Start

Run the scripts/clean-gone to identify and delete 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 when the remote branch is gone?

To delete local Git branches with gone remotes, you prune them by fetching remote updates and inspecting branch tracking status. This Skill automates discovering and safely deleting those stale local branches after user confirmation.

What is the best way to clean up stale local branches in multiple repositories?

The best way to clean up stale local branches across multiple projects is using an automated repository-management script. It applies a deterministic workflow to discover, confirm, and delete branches with deleted remote tracking counterparts across your workspace.

Does pruning gone branches work safely with Git worktrees?

Yes, pruning gone branches works safely with Git worktrees. The cleanup process handles worktrees explicitly and includes safety checks to avoid deleting the currently checked-out branch and prevent data loss during repository maintenance.

Why do I have local branches showing as gone after a remote fetch?

Local branches show as gone after a remote fetch when their corresponding remote tracking branches have been deleted by other collaborators. This leaves stale local branches that clutter your workspace and require automated cleanup.

Can I skip the currently checked-out branch during branch cleanup?

Yes, the branch cleanup process skips the currently checked-out branch automatically. Safety checks are implemented to prevent accidental deletion of the active branch while removing local branches with gone remotes.