ce-clean-gone-branches

Delete local git branches whose remote tracking branch has been removed, including associated worktrees.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/Norfolk-Group/marcela-norfolk-ai --skill ce-clean-gone-branches-norfolk-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-clean-gone-branches
Source: https://github.com/Norfolk-Group/marcela-norfolk-ai/tree/main/skills/compound-engineering/skills/ce-clean-gone-branches
Command: npx skills add https://github.com/Norfolk-Group/marcela-norfolk-ai --skill ce-clean-gone-branches-norfolk-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Over time, local repositories accumulate stale branches whose remote counterparts were deleted after merges, cluttering branch lists and making navigation harder. This Skill finds those orphaned branches and removes them safely, along with any linked git worktrees. ## Core Features & Use Cases - Gone Branch Discovery: Runs git fetch --prune and parses git branch -vv output to identify branches marked : gone], skipping the currently checked-out branch. - Confirmed Deletion: Presents the full list of stale branches and waits for explicit user confirmation before deleting anything. - Worktree Cleanup: Detects and removes associated git worktrees before deleting each branch, preventing dangling worktree references. - Use Case: After a sprint where several feature branches were merged and deleted on the remote, run this Skill to prune all local leftovers in one confirmed pass. ## Quick Start Ask the assistant to clean up local branches that no longer exist on the remote, then confirm the presented list to delete them.

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 delete local git branches that were deleted on the remote?

Run git fetch --prune to sync remote state, then inspect git branch -vv for branches marked ': gone]'. This Skill automates that discovery, lists the stale branches, and deletes each confirmed branch with git branch -D.

How to clean up git worktrees for deleted branches?

Check git worktree list for entries matching the branch name, then run git worktree remove --force on the worktree path before deleting the branch. The Skill performs this check automatically for every gone branch it removes.

Does git branch cleanup delete the currently checked-out branch?

No. The discovery script skips lines starting with '*' in git branch -vv output, which marks the active branch. Git itself also refuses to delete the checked-out branch with git branch -D.

Why does git branch -vv show ': gone]' for a branch?

The ': gone]' marker appears when the branch's configured remote tracking branch no longer exists on the remote, typically after the remote branch was deleted following a merge. Running git fetch --prune updates this state.

Can I review branches before they are deleted?

Yes. The Skill presents the complete list of gone branches and waits for an explicit yes-or-no confirmation through the platform's blocking question tool before deleting anything. Declining stops the process with no changes.