# Clean Gone Branches

Should be used when user asks to "clean gone branches", "remove deleted local...

- Repository: https://github.com/fcakyon/claude-codex-settings (1195 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add fcakyon/claude-codex-settings --skill clean-gone-branches -g -a claude-code -y`
Codex: `npx skills add fcakyon/claude-codex-settings --skill clean-gone-branches -g -a codex -y`
Cursor: `npx skills add fcakyon/claude-codex-settings --skill clean-gone-branches -g -a cursor -y`
Gemini CLI: `npx skills add fcakyon/claude-codex-settings --skill clean-gone-branches -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add fcakyon/claude-codex-settings`

## Description

This skill should be used when user asks to "clean gone branches", "remove deleted local branches", "prune branches removed from remote", or explicitly invokes "clean-gone-branches".

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Clean Gone Branches

Remove local git branches that have been deleted from the remote.

## Process

1. **Update remote references**
   - Run `git fetch --prune`.

2. **Inspect local state**
   - Run `git branch -vv` to find branches marked as `[gone]`.
   - Run `git worktree list` to see whether any of those branches still have worktrees.

3. **Remove worktrees first**
   - For each `[gone]` branch that still has a worktree, remove the worktree before deleting the branch.

4. **Delete the gone branches**
   - Delete each local branch marked as `[gone]`.

5. **Report the result**
   - List removed worktrees and deleted branches.
   - If there are no `[gone]` branches, report that nothing needed cleanup.

