flow-sync · git:20260708.e42b71f · 2026-07-08 · sha256 0cc7a8f07e1670de

flow-sync git:20260708.e42b71fA

Immutable. This exact content is served forever at /api/v1/blob/0cc7a8f07e1670de.

---
name: "flow-sync"
description: "Flow: Sync - Push WIP to Remote for Cross-Machine Pickup - Push the current branch to the remote so you can continue work on another machine. ..."
---
<!-- GENERATED by claude-power-pack - scripts/codex-skill-sync.py; edit .claude/commands/flow/sync.md instead -->

## Codex harness adaptations

Generated from a Claude Code command. Where the procedure references these Claude-only surfaces, adapt as follows:

- Native worktrees (`EnterWorktree`/`ExitWorktree` tool calls, `.claude/worktrees/` paths): use plain git instead - `git worktree add <path> -b <branch>`, work inside it, then `git worktree remove <path>` when done.

# Flow: Sync - Push WIP to Remote for Cross-Machine Pickup

Push the current branch to the remote so you can continue work on another machine. Optional feature - most users won't need this.

## Arguments

None. Operates on the current worktree/branch.

## Instructions

When the user invokes `/flow-sync`, perform these steps:

### Step 1: Validate Context

```bash
# Ensure we're in a git repo
git rev-parse --show-toplevel

# Get current branch
BRANCH=$(git branch --show-current)
```

- If on `main` or `master`: **STOP**. Report: "Cannot sync main branch. Use `/flow-start <issue>` to create a worktree first."
- If not on an `issue-*` branch: Warn but allow (user may have custom branch names).

### Step 2: Check for Uncommitted Changes

```bash
# Check working tree status
git status --short
```

- **If clean:** Skip to Step 3.
- **If dirty (uncommitted changes):** Auto-commit as WIP:
  ```bash
  git add -A
  git commit -m "wip: sync work in progress

  Auto-committed by /flow-sync for cross-machine pickup.
  This commit will be squash-merged - no need to clean up."
  ```
  Report: "Auto-committed WIP changes."

### Step 3: Push to Remote

```bash
git push -u origin "$BRANCH"
```

- If push fails (e.g., rejected): Report the error and suggest `git pull --rebase origin "$BRANCH"` to resolve.

### Step 4: Output

```
Synced branch to remote.

  Branch: issue-42-fix-login-bug
  Remote: origin

  To continue on another machine:
    /flow-start 42
    → Detects remote branch and creates worktree from it
```

## Error Handling

- **Not in a git repo:** Report error clearly.
- **On main branch:** Block sync, suggest `/flow-start`.
- **Push rejected:** Suggest `git pull --rebase` to reconcile.
- **No remote configured:** Report "No remote 'origin' found."

## Notes

- This command is intentionally simple - just commit WIP + push.
- Cross-machine sync operates on the `issue-<N>-<slug>` **branch**, not on worktree paths, so the native `.claude/worktrees/` location (which is per-workstation and gitignored) does not affect it.
- `/flow-start` already handles the receiving end: it detects the remote branch and, because the native `EnterWorktree` tool cannot check out an existing remote branch, adds a worktree tracking it with `git worktree add` and then switches in with `EnterWorktree(path=...)`.
- WIP commits are harmless because `/flow-merge` uses squash-merge, collapsing all commits into one clean commit.
- No configuration required - works with any git remote.