From git-simple
Remove a git worktree, delete its branch, and stop its running services
npx claudepluginhub linkby-com/claude-code-plugin-marketplace --plugin git-simple<branch-name>claude-sonnet-4-5-20250929# Purpose Remove an existing git worktree from the `trees/` directory AND delete the associated git branch. removing the worktree directory, and permanently deleting the branch. This ensures complete cleanup without orphaned processes or files. ## Variables ## Instructions - This command safely removes a worktree and all associated resources - Removes the git worktree using git's built-in removal command - Deletes the git branch associated with the worktree (PERMANENT) - Validates that the worktree and branch were completely removed - Provides clear feedback about what was removed an...
/remove_worktree_promptRemove a git worktree, delete its branch, and stop its running services
Remove an existing git worktree from the trees/ directory AND delete the associated git branch. removing the worktree directory, and permanently deleting the branch. This ensures complete cleanup without orphaned processes or files.
PROJECT_CWD: . (current working directory - the main project root)
BRANCH_NAME: $1 (required)
WORKTREE_DIR: trees/<BRANCH_NAME>
PROJECT_CWD/trees/<BRANCH_NAME>git worktree listgit worktree remove trees/<BRANCH_NAME>git worktree remove trees/<BRANCH_NAME> --forcegit worktree list | grep trees/<BRANCH_NAME>git branch -d <BRANCH_NAME>git branch -D <BRANCH_NAME>git branch --list <BRANCH_NAME>git worktree listgit branch --list <BRANCH_NAME>Follow the Report section format below to provide comprehensive removal information.
After successful worktree removal, provide a detailed report in the following format:
โ
Git Worktree and Branch Removed Successfully!
๐ Worktree Details:
Location: trees/<BRANCH_NAME>
Branch: <BRANCH_NAME>
Status: โ REMOVED
๐๏ธ Cleanup:
โ Git worktree removed
โ Git branch deleted
โ Directory removed from trees/
โ No lingering processes
๐ Important Notes:
โข Both the worktree AND branch '<BRANCH_NAME>' have been deleted
โข This removal is PERMANENT and cannot be undone
โข If you need this branch again, create a new one with: /git-simple:create_worktree_prompt <BRANCH_NAME>
โข The new branch will start from your current HEAD
๐ Verification:
โ Worktree not in git worktree list
โ Branch not in git branch list
โ Directory trees/<BRANCH_NAME> removed
If any issues occurred during removal, include a warnings section:
โ ๏ธ Warnings / Issues:
- Used --force flag to remove worktree (had uncommitted changes)
- Used -D flag to force delete branch (had unmerged changes)
If worktree was already partially removed or not found:
โ ๏ธ Worktree Status:
- Worktree 'trees/<BRANCH_NAME>' was not found in git worktree list
- Directory may have been manually deleted
- Run 'git worktree prune' to clean up worktree metadata
๐ Cleanup Command:
git worktree prune
If orphaned directory exists after removal:
โ ๏ธ Manual Cleanup Required:
- Directory trees/<BRANCH_NAME> still exists after git worktree remove
- This should not happen normally
- To manually remove, run from PROJECT_CWD:
rm -rf trees/<BRANCH_NAME>