rename
Copy pageRenames a worktree’s directory, its Rex session or window, and the per-worktree workrex metadata stored in git config. Optionally also renames the underlying git branch.
workrex rename [old-name] <new-name> [--branch]Arguments
Section titled “Arguments”[old-name]: Optional current worktree name (the directory name). Defaults to the current worktree when run from inside one.<new-name>: The new handle. This becomes the worktree directory name and the Rex session or window base name.
Options
Section titled “Options”| Flag | Description |
|---|---|
--branch, -b | Also rename the underlying git branch to match <new-name>. Fails if the worktree is on a detached HEAD. |
What gets renamed
Section titled “What gets renamed”- The worktree directory (
git worktree move) - The Rex session or window (matching duplicates like
wr-feature-2are renamed preserving their-Nsuffix) workrex.worktree.<handle>.*git config entries (e.g. the stored window/session mode)- Agent state files in
$XDG_STATE_HOME/workrex/agents/*.json(updatesworkdir,window_name,session_name) - Sandbox container marker directory, if present
- The local git branch, only when
--branchis passed
Configuration and state live under Workrex-owned paths. See Configuration.
Examples
Section titled “Examples”# Rename a worktree from inside itworkrex rename feature-new
# Rename a specific worktree by nameworkrex rename feature-old feature-new
# Also rename the branch to matchworkrex rename feature-old feature-new --branch- The main worktree cannot be renamed.
- Rename is non-destructive: uncommitted changes and untracked files survive.
- Submodules are not handled specially;
git worktree movewill error out if the worktree contains submodules. - Any shell already running inside the old directory will have a stale
$PWDafter the rename. Runcd(orcd <new-path>) to refresh. - Collisions are rejected up front: if the new path, Rex target, or branch already exists, the command aborts before making any changes.