---
name: Clean Gone Branches
slug: clean-gone-branches
category: Automation
description: Clean Gone Branches removes local Git branches that were deleted from the remote. Use it after fetching when you want to prune gone branches and clear any related worktrees first.
github: "https://github.com/fcakyon/claude-codex-settings/tree/main/plugins/github-dev/skills/clean-gone-branches"
language: Python
stars: 1086
forks: 102
install: "npx degit https://github.com/fcakyon/claude-codex-settings/tree/main/plugins/github-dev/skills/clean-gone-branches ~/.claude/skills/clean-gone-branches"
installs_to: ~/.claude/skills/clean-gone-branches
source_path: plugins/github-dev/skills/clean-gone-branches/SKILL.md
collection_size: 25
category_size: 1523
collection_url: "https://dirskills.com/collections/fcakyon/claude-codex-settings"
added: 2026-08-20T07:56:43.062Z
last_synced: 2026-08-20T07:56:43.062Z
canonical_url: "https://dirskills.com/skills/clean-gone-branches"
---

# Clean Gone Branches

Clean Gone Branches removes local Git branches that were deleted from the remote. Use it after fetching when you want to prune gone branches and clear any related worktrees first.

**Install:**

```bash
npx degit https://github.com/fcakyon/claude-codex-settings/tree/main/plugins/github-dev/skills/clean-gone-branches ~/.claude/skills/clean-gone-branches
```

## README

# 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.
