igerber

Worktree Rm — Git skill for Claude Code

Git community

Remove a git worktree and optionally delete its branch.

How to install Worktree Rm

Installs to ~/.claude/commands/igerber-diff-diff-worktree-rm.md

Terminal
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/igerber/diff-diff/HEAD/.claude/commands/worktree-rm.md -o ~/.claude/commands/igerber-diff-diff-worktree-rm.md

Restart Claude Code, or start a new session, for it to be picked up.

What Worktree Rm does


description: Remove a git worktree and optionally delete its branch argument-hint: ""

Remove Git Worktree

Remove an existing worktree. Arguments: $ARGUMENTS

Instructions

1. Parse Arguments

Extract **name** from `$ARGUMENTS`. If empty, abort:

Error: Name required. Usage: /worktree-rm 
Tip: Run /worktree-ls to see active worktrees.

Validate that **name** starts with a letter or digit, followed by `[a-zA-Z0-9._-]`. If it starts with `-` or contains invalid

Alternatives in Git

  • Clean Worktrees (Automatic) — Automatically remove all worktrees for branches merged into master 25.5k ★
  • Local Review — You are tasked with setting up a local review environment for a colleague's branch 10k ★
  • Maestro Merge — Merge session worktree branch back to main 530 ★

Full documentation available on GitHub

View Source Repository