ce-clean-gone-branches

Delete local branches with deleted remote tracking branches and their worktrees.

2|Updated May 8, 2026
One-click install
npx skills add https://github.com/xotong/claude-marketplace --skill ce-clean-gone-branches-xotong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-clean-gone-branches
Source: https://github.com/xotong/claude-marketplace/tree/main/plugins/compound-engineering/skills/ce-clean-gone-branches
Command: npx skills add https://github.com/xotong/claude-marketplace --skill ce-clean-gone-branches-xotong

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, and includes scripts (resource) components.

What problem does it solve?

Clean up local branches whose remote tracking branch has been deleted, including any associated worktrees.

Core Features & Use Cases

  • Discover gone branches by fetching remote state and identifying branches marked as gone in git branch -vv.
  • Present branches and ask for confirmation before deletion.
  • Delete confirmed branches, removing any associated worktrees prior to branch deletion.

Use case example: Imagine you have several local branches that no longer exist remotely and associated worktrees; this skill will detect them, confirm with you, and clean them up.

Quick Start

Run the ce-clean-gone-branches skill to prune local gone branches and their worktrees.

Frequently Asked Questions about ce-clean-gone-branches

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

FAQPage Schema
How do I clean up local git branches that are gone remotely?

To clean up local git branches that are gone remotely, you can use a script that runs git fetch --prune and parses git branch -vv to identify branches whose remote tracking branch has been deleted. It then asks for confirmation and removes the confirmed branches.

What is the best way to delete stale local branches and their worktrees?

The best way to delete stale local branches and their worktrees is to detect them by fetching remote state and identifying branches marked as gone in git branch -vv. Any associated worktrees are removed prior to branch deletion to ensure safe cleanup.

Does git prune work with multiple remotes and linked worktrees?

Yes, git fetch --prune works across single or multiple remotes. When removing gone branches, the process applies to development workflows with stale branches and worktrees, ensuring any associated worktrees are removed before the branches are deleted.

Can I safely remove local branches without losing uncommitted worktree changes?

You can safely remove local branches because the process asks for confirmation before deleting any branches. It identifies gone branches by parsing git branch -vv after fetching remote state, giving you control over which branches are deleted.

Why do I still see local branches after running git fetch --prune?

After running git fetch --prune, you still see local branches because git only removes remote tracking references, not local branches. You need to additionally parse git branch -vv to identify branches marked as gone and explicitly delete them.