git-clean-gone-branches

Delete local Git branches whose remote tracking branches are gone.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Removes stale local Git branches whose remote tracking branch has been deleted, preventing cluttered branch lists and accidental work on obsolete branches.

Core Features & Use Cases

  • Discover Gone Branches: Fetches remote state and identifies local branches marked as gone by parsing git branch -vv.
  • Safe Deletion with Confirmation: Presents the full list to the user and proceeds only after an explicit yes-or-no confirmation.
  • Worktree Awareness: Detects and removes associated Git worktrees before deleting the corresponding branch to avoid leftover directories.

Quick Start

Ask the skill to find and remove all local branches whose remotes have been deleted and remove their associated worktrees after you confirm.

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 after remote deletion?

To delete local git branches after remote deletion, you can use a pruning workflow that runs git fetch --prune, parses branch tracking status for gone markers, and deletes branches after explicit user confirmation.

What does the gone marker mean in git branch -vv output?

The gone marker in git branch -vv output indicates that a local branch's remote tracking branch has been deleted from the remote repository, signaling that the local branch is orphaned and ready for cleanup.

How do I remove stale local branches that are linked to git worktrees?

To remove stale local branches linked to git worktrees, you need a cleanup process that detects associated worktrees, removes the worktree directories, and then deletes the corresponding local branches to avoid leftover files.

Can I automatically prune local git branches without manual confirmation?

You cannot automatically prune local git branches without confirmation using this specific workflow, because it explicitly requires a yes-or-no confirmation from the user before proceeding with any branch deletion.

Does git fetch --prune remove local branches automatically?

Git fetch --prune does not remove local branches automatically; it only deletes remote tracking references. You must separately parse the gone markers and explicitly delete the orphaned local branches.