OpenParable
Skip to content
← Back to skills

Clean Gone Branches

Development
clean-gone-branches

Clean Gone Branches is an Agent Skill for development published in the fcakyon/claude-codex-settings repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/fcakyon/claude-codex-settings/blob/HEAD/plugins/github-dev/skills/clean-gone-branches/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/clean-gone-branches, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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.