/commit-commands:clean-gonefrom commit-commands
Cleans up local git branches marked as [gone] (deleted on remote) and removes associated worktrees. Helps keep repositories tidy.
Ships in commit-commands. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You need to execute the following bash commands to clean up stale local branches that have been deleted from the remote repository.
First, list branches to identify those with [gone] status Execute the following command:
git branch -v
Note: Branches prefixed with '+' have an associated worktree and must have that worktree removed before the branch can be deleted.
Next, identify worktrees to remove for [gone] branches Execute the following command:
git worktree list
Finally, remove worktrees and delete [gone] branches (handles both regular branches and branches with worktrees) Execute the following command:
# Process all [gone] branches, stripping the '+' prefix if present
git branch -v | grep '\[gone\]' | sed 's/^[+* ]//' | awk '{print $1}' | while read branch; do
echo "Processing branch: $branch"
# Find and remove worktree if one exists
worktree=$(git worktree list | grep "\\[$branch\\]" | awk '{print $1}')
if [ ! -z "$worktree" ] && [ "$worktree" != "$(git rev-parse --show-toplevel)" ]; then
echo " Removing worktree: $worktree"
git worktree remove --force "$worktree"
fi
# Delete the branch
echo " Deleting branch: $branch"
git branch -D "$branch"
done
After executing these commands, you will:
If no branches are marked as [gone], report that no cleanup is needed.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
npx claudepluginhub minhthang1009/dotclaude --plugin commit-commandsOther plugins' skills for the same job