Guides

Refresh a Workspace

Bring a workspace up to date with its ref, and decide what happens to local changes.

The author pushed new commits. sync re-fetches the ref and hard-resets the worktree to it.

uxd my-project 42 sync
→ fetching origin/feat/login
→ dbf4f36a → dbf4f36a, 0 file(s) changed

The summary line reports the old and new commits and how many files moved, so you can tell at a glance whether anything actually changed.

When the tree is dirty

A plain sync refuses to run on a dirty worktree rather than silently destroying your edits. Pick what should happen to them:

FlagEffect
--stashgit stash the changes, then reset
--discardThrow the changes away, then reset
--freshRemove the workspace and materialize it from scratch
uxd my-project 42 sync --stash
uxd my-project 42 sync --discard
uxd my-project 42 sync --fresh

The three are mutually exclusive — passing two is a usage error (E_USAGE, exit code 2).

--stash when the edits are worth keeping (debug logging you will want back). --discard when they are not (a console.log you already read). --fresh when the workspace itself is suspect — a half-finished install, a node_modules you no longer trust, a rebase that went sideways.

Check first, act second

--dry-run prints what sync would do without touching anything:

uxd my-project 42 sync --discard --dry-run

To see whether a workspace is dirty at all, read its status:

uxd my-project list
SLUG        KIND    BRANCH      STATUS  PORT  AGE  LAST USED
pr-42       pr      feat/login  dirty   5700  2h   1h
feat-search branch  feat/search clean   5701  4h   3h

Refresh the setup too

sync moves the git tree. It does not re-run your install command on its own — that happens on the next run, exec, or shell, and only if the files in setup.cache_key changed:

uxd my-project 42 run dev
→ worktree ready (reused)
→ setup up to date (cache hit)

If the lockfile moved in the fetched commits, the hash changes and the install runs. To force it regardless:

uxd my-project 42 sync --fresh

Refresh the ref before materializing

sync is for workspaces that already exist. To force a re-fetch as part of materializing, use --fetch on the verb you were going to run anyway:

uxd my-project 42 checkout --fetch
uxd my-project 42 run dev --fetch