원클릭으로
merge-worktree
Merge current worktree branch into the original branch, resolve conflicts with AI, then mark worktree for cleanup
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Merge current worktree branch into the original branch, resolve conflicts with AI, then mark worktree for cleanup
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
This skill should be used when the user asks to "commit and push", "commit push", "sync changes", "push changes", "commit and sync", or "update remote". Handles the full workflow of committing changes, pulling with rebase, and pushing to remote.
Sweep recent AI safety research from curated sources (Anthropic alignment science / red team, OpenAI, GDM, Apollo, Redwood, METR, FAR AI, Truthful AI, alphaxiv, arXiv) and surface items matching tracked topic terms (inoculation prompting, reward hacking, exploration hacking, metagaming, eval gaming, OOCR, scheming, alignment faking, sandbagging, etc.). Use when asked to "sweep AI safety", "what's new in alignment", "any recent papers on X", "weekly safety digest", or for staying current on AI safety literature.
Anthropic visual style for plots, diagrams, slides, and web. Use when creating any visual output that should have Anthropic's look-and-feel — matplotlib charts, TikZ diagrams, HTML/CSS, or presentations.
Catch LLM-fabricated citations in BibTeX files. Verifies arXiv/OpenReview entries against live metadata (titles, first authors), then guides manual verification of authorless prose claims. Use before submitting papers, after any LLM-assisted citation generation, or when a reference smells off.
Fact-check prose claims in slides, reports, PDFs, and papers — statistics, comparatives, attributions, causal claims, quotes. Two-pass extract-then-verify protocol with strict numerical precision and a doc-only mode. Use when the user asks to "check the claims in this deck", "fact-check this report", "audit this PDF", "verify the numbers in these slides", or before publishing/shipping any externally-facing document with quantitative claims. Complements `check-bib-references` (which handles BibTeX entries) — this skill handles the prose around them.
Log a one-line knowledge gap to the project's gaps.md file. Use when the user is surprised by Claude's answer, says "I didn't know that", "wait what", or wants to record a misconception they just discovered. Format "I assumed X but actually Y". Personal misconception log — much higher learning signal than feedback memories.
| name | merge-worktree |
| description | Merge current worktree branch into the original branch, resolve conflicts with AI, then mark worktree for cleanup |
Merge the current worktree's branch into the original (parent) branch. Resolves merge conflicts intelligently. Marks the worktree for cleanup after successful merge.
Run these commands to understand the current state:
# Are we in a worktree?
git rev-parse --git-common-dir
git rev-parse --git-dir
git rev-parse --show-toplevel
# Current branch (should be worktree-<name>)
git rev-parse --abbrev-ref HEAD
# Find main worktree path
git worktree list --porcelain
Determine:
WORKTREE_NAME: extracted from current branch (strip worktree- prefix) or directory nameWORKTREE_BRANCH: current branch (e.g., worktree-bold-fox-gjac)MAIN_TREE_PATH: path of the main worktree (first entry in git worktree list)PARENT_BRANCH: branch checked out in the main worktreeIf NOT in a worktree, tell the user and exit. This skill is designed to run from inside a worktree session.
# Ensure all changes are committed in the worktree
git status --porcelain
If there are uncommitted changes:
.claude/settings.json: This file is auto-managed by Claude Code at runtime. Deep-compare (parse JSON, compare key-value pairs ignoring order) against the committed version. If semantically equivalent, git restore it. If there are real value differences, git restore it anyway — runtime settings changes are ephemeral and should not be merged./commit skill or ask the user.Plan files are versioned artifacts that should travel with the branch. Before merging, ensure any plan files created during this worktree session are committed.
# Check for untracked or modified plan files
PLANS_DIR=$(git rev-parse --show-toplevel)/plans
if [ -d "$PLANS_DIR" ]; then
git status --porcelain "$PLANS_DIR"
fi
If there are uncommitted plan files:
git add plans/chore: commit plan files from worktree sessionThis prevents plan files from being orphaned when the worktree is removed (gitignored files and untracked files don't survive cwrm).
# Check how many commits to merge
git rev-list --count <PARENT_BRANCH>..<WORKTREE_BRANCH>
If 0 commits ahead, report "Already up to date" and exit.
Before merging, verify the main tree has no uncommitted changes:
git -C <MAIN_TREE_PATH> status --porcelain
If the main tree has uncommitted changes, warn the user and ask them to commit or stash first. Do NOT proceed with the merge — it will mix their uncommitted work with the merge result.
Run the merge from the main tree:
git -C <MAIN_TREE_PATH> merge --no-edit <WORKTREE_BRANCH>
If merge succeeds: Report success with commit count, skip to step 8.
If merge fails (conflicts): Continue to step 7.
Do NOT abort the merge. Instead:
List conflicting files:
git -C <MAIN_TREE_PATH> diff --name-only --diff-filter=U
For each conflicting file:
<<<<<<<, =======, >>>>>>>)git show <WORKTREE_BRANCH>:<file>git show <PARENT_BRANCH>:<file>.claude/settings.json, etc.): do a deep comparison — parse both sides and check if the actual key-value pairs are semantically equivalent (ignoring key ordering, whitespace). If equivalent, keep the parent branch's version. Only treat as a real conflict if values differ.git -C <MAIN_TREE_PATH> add <file>After all conflicts resolved:
git -C <MAIN_TREE_PATH> commit --no-edit
If you cannot confidently resolve a conflict, leave it and tell the user which files need manual attention.
After successful merge, tell the user:
Merged <N> commit(s) from <WORKTREE_BRANCH> into <PARENT_BRANCH>.
This worktree is now safe to remove:
cwrm --no-merge <WORKTREE_NAME>
Or continue working — run /merge-worktree again later to sync new commits.
cwrm handles that