git-clean-gone-branches

Deletes local branches whose remote tracking branch is gone, including linked worktrees.

2|1|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/wangrenzhu-ola/GaleHarnessCodingCLI --skill git-clean-gone-branches-wangrenzhu-ola
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-clean-gone-branches
Source: https://github.com/wangrenzhu-ola/GaleHarnessCodingCLI/tree/main/plugins/galeharness-cli/skills/git-clean-gone-branches
Command: npx skills add https://github.com/wangrenzhu-ola/GaleHarnessCodingCLI --skill git-clean-gone-branches-wangrenzhu-ola

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.

Core Features & Use Cases

  • Discover gone branches by running the provided script to fetch the latest remote state and identify branches whose origin tracking is gone.
  • Present the list and request a single confirmation to delete all listed branches, ensuring a safe, atomic decision.
  • Delete confirmed branches, removing any linked worktrees and reporting results for transparency.

Quick Start

Run the clean-gone script to prune local branches that no longer exist on the remote.

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 clean up local git branches whose remote has been deleted?

To clean up local git branches whose remote tracking branch is gone, you can run a discovery script to fetch the latest remote state and identify stale branches. The tool then requires a single confirmation to safely delete all listed branches.

Does git branch cleanup also remove linked worktrees?

Yes, git branch cleanup removes any linked worktrees. When deleting confirmed gone branches, the process automatically handles and removes any associated worktrees to ensure a complete and safe cleanup of the local repository.

What's the best way to find stale git branches across multiple repositories?

The best way to find stale git branches is to run a discovery script that fetches the latest remote state and identifies local branches whose origin tracking is gone. This approach is applicable when cleaning up stale branches across multiple repositories.

Is it safe to delete gone branches automatically in git?

Yes, deleting gone branches is safe because the process uses a two-stage workflow that respects the current branch. It first discovers gone branches and then requests a single user confirmation before performing an atomic deletion of all listed branches.

Do I need git installed to prune local branches with no remote?

Yes, you need git installed to prune local branches with no remote. The discovery script relies on git to fetch the latest remote state, identify branches whose origin tracking is gone, and safely remove any associated worktrees.

Why does git keep local branches after the remote branch is deleted?

Git keeps local branches because remote deletions do not automatically propagate to your local environment. You must explicitly fetch the latest remote state, identify the gone branches, and confirm their deletion locally to clean up the stale references.