Worktree Merge
SkillDev toolsMerge worktree branches back to main. Gathers context from specs/plans, merges, cleans up.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Worktree Merge skill
What this skill tells your AI
The instructions your AI receives, as published by neuron-mr-white/unipi in packages/workflow/skills/worktree-merge/SKILL.md and read by ahel’s review.
Merge completed worktree branches into main. Gather context from docs before merging.
Note: Only needed when work was done in a worktree (plan workbranch set). If work was on main branch directly, skip this — changes already on main.
Process
Phase 1: Gather Context
Before merging, read existing specs and plans to understand what each worktree was implementing:
- Read all files in
.unipi/docs/specs/(if exists) - Read all files in
.unipi/docs/plans/(if exists) - Build a map: branch → what it was working on
This context helps during merge conflicts and in the final report.
Phase 2: Resolve Target Branch
- Check for
mainbranch:git branch --list main - If not found, check
master:git branch --list master - If neither exists, ask user for target branch
Phase 3: Resolve Source Branches
If branches provided in args:
- Verify each branch exists:
git branch --list <name> - Check worktree status for each
If no branches provided:
- List all worktrees:
git worktree list - Filter to
.unipi/worktrees/paths only - Show each with status (clean/dirty via
git status) - Ask user which to merge
Phase 4: Merge Each Branch
For each source branch (in dependency order if specs indicate ordering):
- Checkout target:
git checkout main - Merge:
git merge <branch> --no-edit - If conflict:
- Report which files conflict
- Reference the spec/plan context: "This branch was working on: "
- Structured conflict resolution:
- Check finalized plan — read the plan for this branch, understand intended changes
- Brainstorm resolution — reason about which changes align with the plan's intent
- Read codebase — read the conflicting files to understand current state
- Ask user — present options and ask for final decision (always ask, never force)
- Options to present:
- Accept incoming (their changes)
- Accept current (main branch)
- Manual merge (describe what each side does, ask user to decide)
- Skip this branch
- If success:
- Remove worktree:
git worktree remove .unipi/worktrees/<branch-name> - Delete branch:
git branch -d <branch> - Log success with context: "Merged: "
- Remove worktree:
Phase 5: Report
Merge Summary:
✓ feat/auth — merged (auth system implementation from specs/auth-system.md)
✓ fix/login-bug — merged (login fix from plans/bugfix-login.md)
✗ feat/dashboard — CONFLICT in src/dashboard.ts, skipped
Worktrees cleaned: 2 removed
Branches deleted: 2
Phase 6: Suggest Next
- If all merged cleanly → suggest
/unipi:consolidateto save learnings - If conflicts remain → suggest resolving and retrying
/unipi:worktree-merge - If specs/plans exist for merged work → suggest
/unipi:documentto update docs
Important
- ALWAYS read specs/plans before merging — context prevents bad conflict resolution
- NEVER force push or force merge
- Ask user before destructive operations (branch deletion)
- If a worktree has uncommitted changes, warn and skip
Signals
- GitHub stars
- 64
- Forks
- 15
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
worktree-merge-neuron-mr-white- Source
- github.com/neuron-mr-white/unipi