ce-clean-gone-branches

Delete local Git branches with gone remote tracking branches.

Updated Sep 25, 2024
One-click install
npx skills add https://github.com/kwam1na/athena --skill ce-clean-gone-branches-kwam1na
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-clean-gone-branches
Source: https://github.com/kwam1na/athena/tree/main/.agents/skills/ce-clean-gone-branches
Command: npx skills add https://github.com/kwam1na/athena --skill ce-clean-gone-branches-kwam1na

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill 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

  • Detects local branches whose remote counterparts no longer exist by fetching remotes and parsing git branch -vv output for gone state.
  • Safely deletes identified branches and any linked worktrees, after user confirmation.
  • Handles the case where no stale branches exist by reporting NONE and exiting gracefully.

Quick Start

Run the clean-gone script to detect and remove local branches whose remote tracking branch has been deleted, including any associated 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 delete local git branches whose remote tracking branches are gone?

To delete local git branches whose remote tracking branches are gone, this Skill fetches and prunes remotes, parses git branch -vv output for the gone state, and safely deletes identified branches after user confirmation.

How to prune stale local branches and their worktrees safely?

To prune stale local branches and their worktrees safely, the workflow detects branches whose remote counterparts no longer exist and presents them for user confirmation before deleting both the branches and linked worktrees.

What happens if there are no stale branches to clean up in my repository?

If there are no stale branches to clean up in your repository, the clean-gone script reports the __NONE__ state and exits gracefully without making any changes to your local branches or worktrees.

How does git branch -vv identify branches with gone remotes?

The git branch -vv command identifies branches with gone remotes by outputting tracking information that the script parses for the ': gone]' marker, indicating the remote tracking branch has been deleted.

Do I need to manually confirm before the script removes local branches?

Yes, you need to manually confirm before the script removes local branches, as the workflow presents identified stale branches for user approval before deleting them and any associated worktrees.