merge-worktree
Squash-merge the current worktree branch into the main branch (or a specified target).
Skill by nextain
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/nextain-merge-worktree
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/merge-worktree
What's inside
- Skill name
merge-worktree- Description
- Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message. Use when finishing work in a git worktree, at issue-driven-development Commit phase, or whenever asked to merge or squash a worktree branch. Invoke with /merge-worktree.
- License
- Apache-2.0
- Instructions
- 173 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Merge Worktree Squash-merge the current worktree branch back into the target branch with a comprehensive, structured commit message. ## Where this runs Run this from the governed repository root, not from inside the worktree. The worktree is a path you operate on, not a place the session moves into. A session whose shell sits below the governed root cannot produce valid relative evidence — the harness rejects it with `login shell root mismatch` — and the recovery helpers it may need are then only reachable by absolute path. Naming the worktree as an argument keeps one session, one root, and one set of paths. Every git call below is explicit about which repository it addresses: `git -C <worktree-path>` for the branch being merged, and `git -C <repo-root>` for the target branch that receives it. ## Instructions Follow these phases exactly, in order. Do NOT skip phases. --- ### Phase 1: Validation 1. **Resolve the worktree path**: The first argument in `$ARGUMENTS` is the worktree path. Make it absolute. If no argument was given, fall back to the current directory — but only so an already-misplaced session still works; the argument form is the one to use. If `git worktree list` shows no worktree at that path, **stop** and tell the user: > "No worktree at <path>. Create one inside the repository: > `git worktree add worktrees/<project>-issue-<N>-<desc> issue-<N>-<desc>`" Worktrees belong under the repository, not beside it. A worktree at `../` or in a temp directory falls outside every path the contracts govern, and it is invisible to anyone who only has the repository. 2. **Confirm it is a worktree**: `git -C <worktree-path> rev-parse --git-dir` must contain `/worktrees/`. A plain clone is not a worktree and must not be squashed this way. 3. **Identify the branch to merge**: `git -C <worktree-path> branch --show-current`. 4. **Resolve target branch**: - If a second argument was given, use it as the target branch. - Otherwise, detect the default branch: check if `main` exists, else check `master`. If neither exists, stop and ask the user. 5. **Identify the repository root**: `git -C <worktree-path> rev-parse --git-common-dir` points back into the main repository; its parent is the repository root. Every later phase calls this `<repo-root>`. 6. **Clean working tree**: Run `git -C <worktree-path> status --porcelain`. If there are uncommitted changes, stop and tell the user to commit or stash them first. --- ### Phase 2: Research This is the most critical phase. You must deeply understand what was done before writing any commit message. 1. **Commit history**: Run `git -C <worktree-path> log --oneline <target>..HEAD` to see all commits on this worktree branch. 2. **File change summary**: Run `git -C <worktree-path> diff <target>...HEAD --stat` to get an overview of what files changed and how much. 3. **Full diff**: Run `git -C <worktree-path> diff <target>...HEAD` to read the complete diff. Study it carefully. 4. **Read key files**: For the most significantly changed files (largest diffs, new files, deleted files), use the Read tool to understand the full context — not just the diff lines. 5. **Categorize changes**: Mentally group all changes into categories: - Features (new functionality) - Fixes (bug corrections) - Refactors (code restructuring without behavior change) - Tests (new or updated tests) - Docs (documentation changes) - Config/Chore (build, CI, tooling, dependencies) 6. **Identify the dominant type**: Determine which conventional commit type (`feat`, `fix`, `refactor`, `docs`, `chore`, `test`) best represents the overall body of work. --- ### Phase 3: Target branch preparation 1. **Get the repository root** (from Phase 1 step 5). 2. **Check target branch state**: Run `git -C <repo-root> log --oneline -10 <target>` to see recent commits on the target branch. 3. **Detect stray WIP commits**: If the target branch has commits that look like auto-generated WIP commits (e.g., messages starting with `wip:`, `auto-commit`, `WIP`), warn the user and ask if they want to reset to the last clean commit before merging. 4. **Fetch latest** (if remote exists): Run `git -C <repo-root> fetch origin <target> 2>/dev/null` to ensure target is up to date with remote. Do not fail if no remote. --- ### Phase 4: Squash merge 1. **Ensure target branch is checked out** in the repository root: ``` git -C <repo-root> checkout <target> ``` 2. **Perform the squash merge**: ``` git -C <repo-root> merge --squash <worktree-branch> ``` 3. **Handle conflicts**: If the merge reports conflicts: - List all conflicted files - Show the conflict markers - **Stop and report to the user** — do NOT attempt to auto-resolve - Tell them to resolve conflicts in the repository root and then run the skill again 4. If the merge succeeds (no conflicts), proceed to Phase 5. --- ### Phase 5: Craft commit message and commit Based on your Phase 2 research, write the commit message following this **exact structure**:
From nextain/naia-adk, Apache-2.0.
More from nextain/naia-adk
- 0.566score
project-create
nextain
단일 통합 naia-adk v0.2.0의 자동 프로젝트 스캐폴더(adk-scaffold-project.mjs) 및 template-project(AI self-trust 하네스 base)로부터 새 프로젝트(project ADK)를 scaffold하고…
SkillAFreshness: AClaude Code +9 - 0.558score
doc-notes
nextain
작업공간 문서에 달린 메모를 확인하고 처리합니다.
SkillAFreshness: AClaude Code +9 - 0.557score
manage-discord-sessions
nextain
Configure, observe, and recover Discord AI jobs from the ADK workspace with Codex, Claude, OpenCode, or Grok.
SkillAFreshness: AClaude Code +9 - 0.554score
press-release
nextain
보도자료 작성·기자 조사·개인화 발송·결과 수집·인사이트 도출 전체 워크플로우.
SkillAFreshness: AClaude Code +9 - 0.526score
proposal-writing
nextain
공모·지원사업·입찰·투자·협력 제안서와 사업계획서를 공식 양식에 맞춰 작성한다.
SkillBFreshness: BClaude Code +9 - 0.526score
review-pass
nextain
Stage-gated multi-AI cross-validation review with optional REQ-ID traceability.
SkillBFreshness: BClaude Code +9 - 0.526score
manage-skills
nextain
세션 변경사항을 분석해 verify-* 스킬 드리프트를 탐지하고 자동 생성/업데이트합니다.
SkillBFreshness: BClaude Code +9 - 0.523score
payroll
nextain
급여명세서 PDF 생성 + 이메일 발송.
SkillBFreshness: BClaude Code +9 - 0.521score
copyright-reg
nextain
어문저작권 등록 서류 생성.
SkillBFreshness: BClaude Code +9 - 0.521score
patent-draft
nextain
특허 초안 생성 요청 시 반드시 사용.
SkillBFreshness: BClaude Code +9 - 0.518score
patent-pipeline
nextain
코드베이스 기반 AI 자동 특허 발굴·평가·출원 파이프라인.
SkillBFreshness: BClaude Code +9 - 0.513score
email
nextain
Send emails via SMTP adapter with template support.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 10
- Last commit (this folder)
- Aug 31, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/nextain/naia-adk
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from nextain
- 0.566score
project-create
nextain
단일 통합 naia-adk v0.2.0의 자동 프로젝트 스캐폴더(adk-scaffold-project.mjs) 및 template-project(AI self-trust 하네스 base)로부터 새 프로젝트(project ADK)를 scaffold하고…
SkillAFreshness: AClaude Code +9 - 0.558score
doc-notes
nextain
작업공간 문서에 달린 메모를 확인하고 처리합니다.
SkillAFreshness: AClaude Code +9 - 0.557score
manage-discord-sessions
nextain
Configure, observe, and recover Discord AI jobs from the ADK workspace with Codex, Claude, OpenCode, or Grok.
SkillAFreshness: AClaude Code +9 - 0.554score
press-release
nextain
보도자료 작성·기자 조사·개인화 발송·결과 수집·인사이트 도출 전체 워크플로우.
SkillAFreshness: AClaude Code +9 - 0.526score
review-pass
nextain
Stage-gated multi-AI cross-validation review with optional REQ-ID traceability.
SkillBFreshness: BClaude Code +9 - 0.526score
manage-skills
nextain
세션 변경사항을 분석해 verify-* 스킬 드리프트를 탐지하고 자동 생성/업데이트합니다.
SkillBFreshness: BClaude Code +9
Cite this page
merge-worktree skill. Agent Mart. https://agentmart.dev/skills/nextain-merge-worktree (last updated 2026-10-24)