ce-clean-gone-branches

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

2|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/thisisryanswift/zellij-agent-tools --skill ce-clean-gone-branches
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-clean-gone-branches
Source: https://github.com/thisisryanswift/zellij-agent-tools/tree/main/.opencode/skills/ce-clean-gone-branches
Command: npx skills add https://github.com/thisisryanswift/zellij-agent-tools --skill ce-clean-gone-branches

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

  • Discover and list stale local branches marked as gone on the remote.
  • Delete branches safely, removing any related worktrees when present.
  • Preserve current branch and provide a guided confirmation flow.

Quick Start

Run the cleanup to remove local branches whose remote tracking branch has been deleted, including 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 clean up local git branches whose remote has been deleted?

To clean up local git branches with gone remotes, run a fetch with prune to detect stale tracking references, then delete the branches and any associated worktrees. The workflow lists affected branches and asks for confirmation before removal.

What happens to git worktrees when I delete a stale local branch?

When deleting a stale local branch, associated git worktrees are also removed. The cleanup workflow identifies branches marked as gone on the remote and safely removes both the branch and any linked worktree directories during the deletion process.

How does git fetch prune help find gone branches?

Git fetch prune removes remote tracking references that no longer exist on the remote repository. After pruning, local branches that previously tracked those deleted remotes are marked as gone, which can be detected using git branch -vv for cleanup.

Is it safe to delete stale local branches automatically?

Deleting stale local branches is safe because the workflow preserves your current branch and provides a guided confirmation flow. It presents affected branches for review before removing them and any associated worktrees, ensuring you approve the changes.

Why do I still see local branches after the remote was deleted?

Local branches remain after a remote is deleted because git does not automatically remove local tracking branches. You need to run a fetch with prune to update remote tracking references, then detect and delete the gone branches manually or via a cleanup workflow.