mcpField
C
clean-gone-branches

clean-gone-branches

github.com/fcakyonDevelopment1.2k36 installsUpdated today
Repository

About clean-gone-branches

A Git cleanup skill that removes local branches whose remote counterparts are gone, checking and removing associated worktrees first. It is for keeping a repository’s local branch list aligned with remote state.

Key features

  1. 01Prune remote references
  2. 02Find branches marked gone
  3. 03Check worktrees for affected branches
  4. 04Remove worktrees before branches
  5. 05Report cleanup results

Use cases

  1. 01Clean up branches deleted from a remote
  2. 02Remove worktrees tied to gone branches
  3. 03Confirm when no cleanup is needed

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/fcakyon/claude-codex-settings --skill clean-gone-branches

After installing, type/clean-gone-branchesin Claude Code to confirm it loaded.

Details

From the project 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.

Comments

Markdown supported