worktree-merge
Merge a worktree branch into main, remove the worktree, and delete the branch. Use when done with a worktree and ready to integrate or discard the work.
by incubateur-ademe★ 45 GitHub stars
Install worktree-merge in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Worktree Cleanup
Merge a completed worktree branch into main, remove the worktree directory, and delete the branch.
Instructions
Step 1: List active worktrees
Run git worktree list and parse the output to find all worktrees except the main one.
If there are no worktrees to clean up, tell the user and stop.
Step 2: Ask user which worktree to clean up
Use the AskUserQuestion tool to present the list of active worktrees as options. Show the branch name and directory path in each option.
Step 3: Confirm merge strategy
Use AskUserQuestion to ask whether to:
- Merge into main — merge the branch into main before cleanup
- Remove only — just remove the worktree and branch without merging (for abandoned work)
Step 4: Execute cleanup
If merging:
# 1. Ensure we're on main and up to date
git checkout main
# 2. Merge the branch
git merge --ff-only <branch-name>
# 3. Remove worktree and delete branch
scripts/remove-worktree.sh <branch-name> --delete-branch
If removing without merge:
# Remove worktree and delete branch
scripts/remove-worktree.sh <branch-name> --delete-branch
Step 5: Report result
Show what was done: merged (if applicable), worktree removed, branch deleted.
Arguments
$ARGUMENTS
Allowed tools
Tools this skill is permitted to call.
- 01
Bash
FAQ
What does the worktree-merge skill do?
Merge a worktree branch into main, remove the worktree, and delete the branch. Use when done with a worktree and ready to integrate or discard the work.
How do I install the worktree-merge skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the worktree-merge skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…