Merge Command
Description
Finalize worktree work: update docs, commit, merge to main, clean up. **Context from user:** $ARGUMENTS ---
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
Repository README
This is the README for peterkrueck/Claude-Code-Development-Kit, shared by 4 entries
in this directory. It describes the repository, not this entry specifically.
Merge Command
Finalize worktree work: update docs, commit, merge to main, clean up.
**Context from user:** $ARGUMENTS
Pre-flight
**Verify worktree:**
git worktree list git branch --show-currentIf the current branch is `main`, stop: "You're on main — nothing to merge. Use this command from inside a worktree."
**Capture branch name** and **main repo path** (the `git worktree list` entry on branch `main`).
**Survey what this branch has done** — this informs the commit/merge messages and doc updates:
git log main..HEAD --oneline git diff main --stat git diff --stat git status
Step 1: Update Documentation
Invoke the `/update-docs` skill, passing the branch changes as context. If no doc updates are needed, it will skip — that's fine.
Step 2: Commit Uncommitted Changes
Run `git status`. If there are uncommitted changes:
- Review the diff to understand what changed
- Stage relevant files by name — never stage
.env, credentials, or secrets - Write a commit message following repo style (
feat:,fix:,chore:, etc.) - Commit using HEREDOC format with Co-Authored-By trailer
If the working tree is clean, skip to Step 3.
Step 3: Merge to Main
**Critical: You cannot `git checkout main` inside a worktree** — main is checked out in the main repo. Use `git -C ` for all merge operations.
Verify there are commits to merge:
git log main..HEAD --onelineIf empty (no commits at all on branch), ask the user whether to just clean up.
Merge with `--no-ff` to preserve branch history:
git -C merge --no-ff -m ""Merge message format — match established pattern:
Merge branch '' — Co-Authored-By: ClaudeUse HEREDOC for the message to preserve formatting.
**If merge conflicts occur: STOP.** Report the conflicts to the user. Do NOT clean up the worktree — the user needs it to resolve conflicts.
Step 4: Clean Up Worktree
Only after a **successful** merge:
Use the `ExitWorktree` tool with:
action: "remove"discard_changes: true
This is safe because all work is now on main. The tool warns about "unmerged commits" because it checks the worktree branch, not main — but the commits ARE on main after Step 3.
Step 5: Confirm
Report to user: what was merged (commit count + summary), and that we're back on main.
Related Skills
使用 Git Worktrees
创建孤立的 Git worktrees,带有智能目录选择与安全验证。
Git Claude skills github
[Building agent skills blog](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-ag
Git #148
, [#161](https://github.com/affaan-m/everything-claude-code/pull/161))
Git GitHub MCP
| Token | Repos, issues, PRs, workflows |
Git GitHub MCP Server
Official first-party server to read repos, manage issues/PRs, and automate workflows.
Git mcp-server-github
GitHub API integration for repos, issues, PRs.
Git