florianbruniaux/claude-code-ultimate-guide/git-worktree-remove
Claude Code and agent skill by florianbruniaux/claude-code-ultimate-guide
- community
Checking that the SKILL.md file is still in the repository.
Safely remove a git worktree with branch cleanup and safety checks
Install
npx vskill@latest install florianbruniaux/claude-code-ultimate-guide/git-worktree-removeSKILL.md
Git worktree remove
Safely remove a single git worktree with branch cleanup, merge verification, and database branch teardown.
Core principle: Safety checks first, then clean removal of worktree + branch + DB resources.
Part of: Worktree Lifecycle Suite | `/git-worktree` | `/git-worktree-status` | `/git-worktree-clean`
Process
- Validate Target: Identify worktree to remove
- Safety Check: Protect main/develop branches
- Check Merge Status: Warn if branch has unmerged changes
- Check Uncommitted Changes: Warn if worktree has dirty state
- Remove Worktree:
git worktree remove - Delete Local Branch:
git branch -d(or-Dwith confirmation) - Delete Remote Branch:
git push origin --delete(with confirmation) - Database Cleanup Reminder: Suggest DB branch deletion if applicable
- Prune References:
git worktree prune
Safety checks
Protected branches
Uncommitted changes
Merge status
Removal steps
Database branch cleanup
After worktree removal, remind about associated database branches:
Report format
Successful removal (merged branch):
Removal with warnings (unmerged branch):
Flags
| Flag | Effect | |
|---|---|---|
--force | Skip uncommitted changes warning | |
--keep-branch | Remove worktree but keep the branch | |
--keep-remote | Don't delete remote branch |
Quick reference
| Situation | Action | |
|---|---|---|
| Branch is merged | Safe delete (branch -d) | |
| Branch is unmerged | Warn + require confirmation (branch -D) | |
| Uncommitted changes | Warn + offer force/cancel | |
| Protected branch (main/develop) | Block removal | |
| Remote branch exists | Ask to delete remote | |
| DB branch detected | Remind with exact command | |
| Stale references | Auto-prune |
Common mistakes
Removing worktree for main/develop
- Always blocked by safety check. Reconfigure protected branches if needed.
Deleting unmerged branch without checking
- Always verify merge status. Unmerged branches require explicit
--forceor-D.
Forgetting database branch cleanup
- Leaves orphaned DB branches consuming resources. Command reminds automatically.
Using `rm -rf` instead of `git worktree remove`
- Leaves stale worktree references in
.git/worktrees/. Always use git commands.
Usage
Branch or worktree path: $ARGUMENTS
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexamples/skills/git-worktree-remove/SKILL.md
Popularity
- Repository stars
- 5,848
- Repository forks
- 766
- 7-day trend score
- 43
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Aug 2026, 2 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/florianbruniaux/claude-code-ultimate-guide/git-worktree-remove)