The merge command performs a safe, two-phase merge of a worktree's feature branch back into its base branch with conflict guard -- file-level overlap detection that warns before merge when two branches touch the same files. After a successful merge, it automatically cleans up the worktree, tmux session, and status tracking.
Usage
owt merge <name> [OPTIONS]Alias: owt m
Arguments
| Argument | Description |
|---|---|
name | Worktree name or branch name to merge |
Options
| Option | Description |
|---|---|
--base <branch> | Target base branch (default: auto-detected) |
--keep | Keep the worktree after merging (skip auto-cleanup) |
-y, --yes | Skip confirmation prompt |
Two-Phase Merge
Open Orchestrator uses a two-phase merge strategy to catch conflicts early and ensure clean merges.
Before either phase begins, the main repository is auto-stashed if dirty (including untracked files with -u), and gitignored files are cleaned (git clean -fdX) to prevent checkout failures from build artifacts or generated files like .harness/ directories. The stash is restored after the merge completes.
Phase 1: Merge Base into Feature
base (main): A---B---C---D
\
feature: E---F---GFirst, the base branch is merged into the feature branch. This catches any conflicts before touching the base branch:
base (main): A---B---C---D
\ \
feature: E---F---G---M1 (merge base into feature)If there are conflicts at this stage, the merge stops and you can resolve them in the feature branch without any risk to the base branch.
Phase 2: Fast-Forward Feature to Base
Once Phase 1 succeeds (feature branch now contains all base changes), the feature branch is fast-forwarded back into the base branch:
base (main): A---B---C---D---M1 (fast-forward)
\ \ /
feature: E---F---G---M1Because Phase 1 already incorporated all base changes, Phase 2 is always a clean fast-forward.
Examples
Basic Merge
owt merge feature/authOutput:
Merging feature/auth into main...
Phase 1: Merging main into feature/auth...
✓ No conflicts
Phase 2: Fast-forwarding main to feature/auth...
✓ main updated
Cleanup:
✓ Killed tmux session: owt-feature-auth
✓ Removed worktree
✓ Cleared status tracking
Merge complete!Merge to a Specific Base
owt merge feature/api --base developKeep Worktree After Merge
owt merge feature/auth --keepThe worktree and tmux session remain after merging. Useful if you want to continue working on follow-up tasks.
Skip Confirmation
owt merge feature/auth --yesConflict Guard
Before starting the merge phases, Open Orchestrator checks for file-level overlaps between the feature branch and other active worktrees. If the same files are modified in multiple branches, you get a warning:
⚠ File overlap detected with 2 other worktrees:
- api-refactor: src/routes/users.ts, src/middleware/auth.ts
- db-migration: src/models/user.ts
Proceed anyway? [y/N]This catches potential merge conflicts early -- before they become real git conflicts. Overlaps also surface in the Control Plane's NEEDS YOU section, where you can press f to fix (open the conflicted files).
Conflict Handling
If Phase 1 encounters conflicts:
Merging feature/auth into main...
Phase 1: Merging main into feature/auth...
✗ Merge conflicts detected:
- src/auth/middleware.js
- src/config/auth.ts
Resolve conflicts in the feature branch:
owt switch feature/auth
# Fix conflicts, then:
git add .
git commit -m "Resolve merge conflicts"
# Then retry:
owt merge feature/authThe base branch is never modified during Phase 1, so conflicts are always safe to resolve.
Auto-Cleanup
After a successful merge (unless --keep is used), Open Orchestrator automatically:
- Kills the tmux session for the worktree
- Removes the git worktree directory
- Clears status tracking data for the worktree
This keeps your development environment clean after completing a task.
See Also
owt ship-- Commit + merge + delete in one shotowt queue-- Optimal merge order for multiple worktreesowt new-- Create worktreesowt delete-- Delete without mergingowt sync-- Sync with upstream before merging