Command Palette

Search for a command to run...

Back to skills
skill № 55637

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.

FreeNo executable scripts
incubateur-ademeby 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
Sign up freeI already have an account

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:

  1. Merge into main — merge the branch into main before cleanup
  2. 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.

  1. 01Bash

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

Compare worktree-merge with