From worktree
Squash-merge the current worktree branch into the main branch. Analyzes git history and source code to craft a comprehensive commit message. Must be run from inside a worktree.
How this skill is triggered — by the user, by Claude, or both
Slash command
/worktree:mergeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Squash-merge the current worktree branch into the target branch, crafting a comprehensive commit message from git history and source analysis.
Squash-merge the current worktree branch into the target branch, crafting a comprehensive commit message from git history and source analysis.
Invoked as: $ARGUMENTS
git rev-parse --git-dir 2>/dev/null || echo "NOT_A_GIT_REPO"git branch --show-current 2>/dev/null || echo "unknown"git status --porcelain 2>/dev/null || echo "(error)"git rev-parse --git-dir. If the output does NOT contain /worktrees/, stop with: "This skill must be run from inside a git worktree. Use /worktree:create to create one first."git branch --show-current and save the result as WORKTREE_BRANCH.git status --porcelain. If the output is non-empty, stop with: "Uncommitted changes in worktree. Commit or stash them first."git rev-parse --git-common-dir and resolve the parent directory as ORIGINAL_REPO (e.g., strip the trailing /.git component from the result if present, or use the directory containing the .git folder).git -C $ORIGINAL_REPO diff-index --quiet HEAD --. If this fails (exit code non-zero), stop with: "Original repo has uncommitted changes. Commit or stash them before merging."$ARGUMENTS is provided and non-empty, use it as TARGET.git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null and extract the short branch name (strip refs/remotes/origin/ prefix).main exists: git rev-parse --verify main 2>/dev/null.master exists: git rev-parse --verify master 2>/dev/null.git -C $ORIGINAL_REPO fetch origin $TARGET 2>/dev/null || truegit -C $ORIGINAL_REPO log --oneline -10 $TARGET and check commit messages. If any start with wip:, auto-commit, or WIP, print a warning: "Warning: target branch appears to have WIP commits. Verify before merging."git log --oneline $TARGET..HEAD to list all commits on this branch since it diverged from TARGET.git diff $TARGET...HEAD --stat to get the file change summary.git diff $TARGET...HEAD to get the full diff. Read it carefully.feat, fix, refactor, test, docs, chore.git -C $ORIGINAL_REPO checkout $TARGETgit -C $ORIGINAL_REPO merge --squash $WORKTREE_BRANCHgit -C $ORIGINAL_REPO merge --abortCraft a commit message using the Phase 3 analysis. Use this exact format:
<type>: <concise summary in imperative mood, under 72 chars, no trailing period>
<2-4 sentence paragraph explaining what changed and why>
Changes:
- <grouped bullet points by category>
Co-Authored-By: Claude <model> <[email protected]>
Commit using a heredoc to preserve formatting exactly:
git -C $ORIGINAL_REPO commit -m "$(cat <<'EOF'
<crafted message here>
EOF
)"
Error recovery: if the commit fails for any reason (e.g., pre-commit hook rejection), run git -C $ORIGINAL_REPO reset HEAD to unstage all changes, then report the failure with: "Commit failed. Staged changes have been unstaged. Reason: . Fix the issue and re-run /worktree:merge."
Run git -C $ORIGINAL_REPO log --oneline -3 to confirm the commit landed.
Report in this format:
Merged: <commit-hash> — <summary line>
Target: <TARGET>
Branch: <WORKTREE_BRANCH>
Note: Worktree still exists. Run /worktree:cleanup to remove it, or:
git worktree remove <worktree-path>
npx claudepluginhub jaebit/claudemate --plugin worktreeSquash-merges git worktree branch to target branch with structured commit message based on change categorization. Validates retrospective completion and clean tree first.
Merges a source branch into the current working branch with preflight checks, conflict handling, optional session documentation, and targeted validation.
Merges reviewed PRs when triggered by /pr-merge or merge commands. Handles squash/rebase, worktrees, integration branches, and auto-merge for CI gating.