Skip to content

The sync command updates worktrees with changes from their upstream branches, keeping feature branches current with the main codebase.

Usage

bash
owt sync [name] [OPTIONS]

Arguments

ArgumentDescription
nameWorktree name to sync (optional when using --all)

Options

OptionDescription
--allSync all worktrees
--jsonOutput results in JSON format

Sync Strategies

Open Orchestrator uses these strategies when syncing:

StrategyDescription
mergeMerge upstream into branch (default)
auto_stashAutomatically stash and restore uncommitted changes
prune_remotePrune deleted remote branches

Examples

Sync a Single Worktree

bash
owt sync add-auth

Sync All Worktrees

bash
owt sync --all

JSON Output

bash
owt sync --all --json

Output:

json
{
  "results": [
    {
      "worktree": "add-auth",
      "status": "success"
    },
    {
      "worktree": "api-v2",
      "status": "up_to_date"
    },
    {
      "worktree": "fix-nav",
      "status": "conflicts"
    }
  ]
}

Sync Statuses

Each worktree sync returns one of these statuses:

StatusDescription
successSynced successfully with new changes
up_to_dateAlready up to date, nothing to do
conflictsMerge conflicts detected, manual resolution required
no_upstreamBranch has no upstream configured
uncommitted_changesCannot sync due to uncommitted changes
errorAn unexpected error occurred

Conflict Resolution

When a sync results in conflicts:

bash
# Switch to the worktree
owt switch add-auth

# Check which files have conflicts
git status

# Fix conflicts in your editor, then:
git add .
git commit -m "Resolve merge conflicts with upstream"

Use Cases

Morning Sync

bash
# Start of day - sync all worktrees with upstream
owt sync --all

Before Merging

bash
# Sync before merging to catch conflicts early
owt sync add-auth
owt merge add-auth

CI/CD Integration

bash
# Use JSON output to check for issues
owt sync --all --json | jq '.results[] | select(.status == "conflicts")'

See Also