git-clean-gone-branches

Delete local git branches whose remote tracking branches are gone.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/jaydubya818/New_baseline --skill git-clean-gone-branches-jaydubya818
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-clean-gone-branches
Source: https://github.com/jaydubya818/New_baseline/tree/main/skills/compound-engineering/plugins/compound-engineering/skills/git-clean-gone-branches
Command: npx skills add https://github.com/jaydubya818/New_baseline --skill git-clean-gone-branches-jaydubya818

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Delete local branches whose remote tracking branch has been deleted, including any associated worktrees, to keep the repository clean and accurate.

Core Features & Use Cases

  • Discover stale branches locally by inspecting git branch -vv for [gone] statuses and identify branches that no longer exist on the remote.
  • Confirm and remove stale branches, including any worktrees, while safeguarding the current checked-out branch and ensuring commands use the explicit git binary.
  • Use cases include cleaning up feature branches after their PRs are merged or closed, and pruning long-lived experiments that are no longer in use.

Quick Start

Run the script to discover stale local branches and remove them along with any associated worktrees.

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 that are no longer on the remote?

To delete local git branches that are no longer on the remote, run a script that discovers stale branches via git branch -vv, prompts for confirmation, and safely removes them along with any associated worktrees.

What are gone branches in git and how do I clean them up?

Gone branches are local branches whose remote tracking branch has been deleted. You can clean them up using a bash script that discovers these stale branches, prompts for confirmation, and removes them while safeguarding the current checked-out branch.

Does this branch cleanup method remove associated git worktrees?

Yes, removing stale local branches with this method also deletes any associated git worktrees, ensuring the repository remains clean and accurate without leaving orphaned working directories behind.

Can I safely prune stale local branches without deleting my current work?

Yes, pruning stale local branches is safe because the script skips the current checked-out branch and its worktrees, applying guards against destructive actions while removing only confirmed gone branches.

Do I need any special tools besides git to prune stale local branches?

No, you only need the standard git binary installed. The cleanup relies on a small Bash script that uses explicit git commands to discover and remove stale local branches and their worktrees.