docs/commands/sync.md
Sync git repo: pull from tracking remote, merge upstream changes, optionally push.
Single command to bring a repository up to date. Pulls from the tracking branch, syncs upstream if configured (fork workflow), and optionally pushes. Works with both plain git and jj (jujutsu) colocated repos.
Use this block when passing f sync behavior to another agent:
--push.--stash=true, --fix=true.[git].remote first, then standard fallback behavior.jj resolve guidance.# Pull latest from remote (no push by default)
f sync
# Pull and push
f sync --push
# Pull with rebase instead of merge
f sync -r
# Pull with rebase and push
f sync -r --push
| Option | Short | Description |
|---|---|---|
--rebase | -r | Use rebase instead of merge when pulling |
--push | Push to configured git remote after sync (default: off) | |
--no-push | Skip pushing (legacy; already the default) | |
--stash | -s | Auto-stash uncommitted changes (default: true) |
--stash-commits | Stash local JJ commits to a bookmark before syncing (jj only) | |
--allow-queue | Allow sync even when commit queue is non-empty | |
--create-repo | Create origin repo on GitHub if it doesn't exist | |
--fix | -f | Auto-fix conflicts using Claude (default: true) |
--no-fix | Disable auto-fix | |
--max-fix-attempts <N> | Maximum auto-fix attempts (default: 3) | |
--allow-review-issues | Allow push even if P1/P2 review todos are open | |
--compact | Legacy noise-reduction flag (jj fetch output is already compact by default) |
--stash is setPulls from the tracking remote/branch (e.g. origin/main). If the branch has no tracking info but the push remote has a matching branch, auto-configures tracking.
--rebase: runs git pull --rebasegit pull --no-rebase --no-edit (merge without opening an editor)--fix is enabledIf an upstream remote exists (fork workflow), fetches and merges upstream changes into the current branch.
If no upstream remote but on a feature branch, syncs from origin/<default-branch> (e.g. origin/main) into the current branch.
Only when --push is passed:
--allow-review-issues)--create-repo if origin doesn't existRestores auto-stashed changes if any were stashed in step 1.
When remote commit ranges are discovered (typically during jj fetch), Flow prints a deduplicated list of newly synced commits (hash + subject) and copies that same list to your clipboard.
If no synced commit ranges were detected, this section is skipped.
Set FLOW_NO_CLIPBOARD=1 to disable clipboard copy.
When a .jj directory is present and healthy, sync uses the jj flow instead of plain git. Falls back to git if:
git.remote is not origin/upstreamUse --stash-commits to bookmark local jj commits before syncing.
jj fetch output is compact by default; synced commit details are emitted once at the end for clipboard use.
If the commit queue has pending entries and sync would rebase (rewriting SHAs), sync refuses to proceed. Use --allow-queue to override, or process the queue first with f commit-queue list.
Set in flow.toml under [git]:
[git]
remote = "origin" # default push remote
When a fork push target is configured, sync redirects push to the fork remote automatically.
# Basic sync (pull only)
f sync
# Sync and push
f sync --push
# Rebase workflow
f sync -r --push
# Sync a fork (has upstream remote)
f sync --push
# Create missing origin and push
f sync --push --create-repo
# Skip auto-fix for conflicts
f sync --no-fix
# Allow sync with pending commit queue
f sync --allow-queue
Sync found files with unresolved merge conflicts. By default (--fix), it tries to auto-resolve. If that fails, resolve manually:
git status # see conflicted files
# edit and fix conflicts
git add <files>
f sync # retry
Rebase-based sync can rewrite commit SHAs, breaking queued commits. Either:
f commit-queue list # review the queue
f sync --allow-queue # override the guard
The push remote doesn't exist or auth/network failed. For missing origin:
f sync --push --create-repo
If jj sync fails due to workspace/store issues, sync automatically retries with plain git. Fix jj with:
jj git import
# or if still broken:
rm -rf .jj && jj git init --colocate
This means sync/rebase completed but conflict revisions still exist in jj.
jj resolve