Managing worktrees
Windows worktree actions match native and Git path spellings consistently.
Containment checks compare directory segments, including names such as
..cache, and protect the caller's own worktree from removal.
The Worktrees page is a cross-project audit and cleanup tool for local git worktrees. It helps you decide what has landed, what still carries local work, and which working directories are safe to remove.
For the difference between a Task, Worktree, Terminal Tab and Split, start with Concepts. To create or adopt a task, see The TUI.
Branch naming
A managed task created without an explicit branch derives its branch name
from the task title, following the repository's own naming convention: Rove
scans the repo's existing branches (local + origin) and matches the
dominant style: a type prefix like feat//fix//chore/ when that's what
the repo uses, or a bare kebab slug otherwise (also the fallback for an
empty repo). Name collisions get a short -2/-3 suffix, and a name that
would clash with an existing branch's folder (fix beside fix/login, or
feat/x beside feat) is skipped or flattened (feat-x). Generated names
never contain Rove branding. An explicit --branch on creation,
update --branch afterwards, and b on a task row in the sidebar override this
entirely. A branch still on its new-task placeholder is renamed once,
automatically, when the task gets a real title (skipped if the branch
already has an upstream); after that Rove never touches it again.
The title slug keeps whole words within 32 characters. If the first word alone exceeds 32 characters, only that word is hard-cut to the limit.
Where worktrees live
By default a managed worktree lands under
~/.rove/worktrees/<repo-basename>-<hash>/<slug>, where <slug> is a
random animal name (-v2/-v3 on collision). Settings → General →
Worktree location relocates the root (a $project_dir token expands to each
task's project root). Remote (SSH) projects put worktrees under the remote
project's own path at <project>/.rove/worktrees/<slug>.
Move a task to another project
A task created in the wrong project moves with the row menu's "Move to
project…" (TUI and web) or rove api update --task-id ID --project PATH. The
move regroups the rows only: the checkout, branch, terminals and running
engine stay exactly where they are, so the conversation keeps resuming. A
worktree task remembers the repo that cut it, so Remove session, Land and
forks still run in that repo, and moving it back clears the link. Children
follow their parent; a child, a routine session and a multi-repo task are not
movable on their own.
Ignored directories are cloned in
On macOS a new local task's worktree gets the main checkout's node_modules
(including packages/*/node_modules), .venv, target and .build,
cloned copy-on-write on the same APFS volume, before .rove/init.sh runs. They
are copies, not links: editing one changes only that worktree, and the disk
cost stays near zero until it does. Turn it off with worktree.cloneIgnored
or change the list per repo with .rove/clone-dirs; see
Cloned ignored directories.
Cross-volume, non-APFS, SSH and non-macOS setups behave as before.
Fork a task with its uncommitted work
A new task normally starts from a branch's last commit, so edits the original
has not committed stay behind. A fork clones the original's worktree
instead: modified tracked files, staged changes, untracked files and
gitignored directories (node_modules, build output) all arrive, on a new
branch rooted at the original's HEAD. The original is not touched, and the two
share no state afterwards: an edit on one side never shows on the other.
rove api add --fork <task-id> --command claude --prompt "try the other approach"The fork is a sibling in the same repo, titled <original title> (fork)
unless you pass --title. In the TUI and the web, the quick-fork composer
(ctrl+f, or New conversation → Fork) does the same whenever the base stays
on the original's own branch.
The copy is made with the filesystem's clone call (clonefile on APFS,
reflink on btrfs and XFS), so it takes well under a second whatever the size
and uses no extra disk until either side writes. Rove never falls back to a
full copy. When the volume cannot clone files, add --fork fails with
FORK_UNSUPPORTED and creates nothing, and the TUI and web start the task
the old way and say that the uncommitted work stays in the original. The same
refusal covers a directory task (a project's own checkout included), a
multi-repo task and a remote (SSH) project.
Not carried over: state git keeps in the original's git directory outside the
index, such as a half-done merge or rebase. Deleting a fork works like deleting
any worktree, so its uncommitted work needs --force (and is salvaged).
Open and navigate the page
- Focus the task sidebar with
ctrl+q. - Press
x. - Use the up/down arrows to select a worktree.
- Press
escorqto return to the workspace.
The page lists non-main worktrees with a branch checked out from every saved local project (bare and detached-HEAD worktrees are skipped). Remote SSH projects are not included. It loads local git facts first, then fills in remote and GitHub PR signals; a slow or unavailable network therefore leaves useful local rows on screen.
Read a worktree row
Each row shows its branch and absolute path. These badges are evidence, not an automatic cleanup decision:
| Badge | Meaning |
|---|---|
rove | The path is inside a recognized Rove-managed root. It does not by itself mean a Task currently points to it. |
dirty | git status --porcelain found modified, staged, or untracked files. |
on remote | A branch with this name exists on origin. |
not pushed | No branch with this name exists on origin. |
remote unknown | There is no reachable origin, or the remote check failed or timed out. |
PR open | GitHub reports an open PR for the branch. |
merged (PR) | GitHub reports a merged PR for the branch. |
in main | The branch is zero commits ahead of the detected remote default branch. |
PR closed | GitHub reports a closed, unmerged PR. |
stale | No stronger signal exists and the last activity is more than 14 days old. |
dirty is git status --porcelain and nothing else, so a worktree whose only
work is gitignored — a HANDOFF.md, a .scratch/ — carries no dirty badge
and can still read in main. Deletion checks more than the badge does
(git status --ignored as well), so such a row looks safe to clean here and is
still refused at the delete, offering the two-stage force flow below. That is
the gate working: the badge reports what git reports, and the refusal names the
paths git will not.
The rove badge describes where the directory lives. Adoption describes
whether Rove has a Task for that worktree. Either a Rove-managed or external
worktree can be adopted through New task → Adopt Worktree or rove adopt.
Only an adopted/tracked worktree can use the page's Land action.
Remote and PR badges are advisory. They never bypass the dirty-worktree gate,
and remote unknown is not treated as permission to delete.
Land a tracked branch
Landing merges the selected task branch into the branch currently checked out in the project's base checkout.
- Make sure the base checkout is on the branch you intend to receive the work and has no uncommitted or untracked files.
- Select the worktree and press
l. - Confirm the branch and base-checkout operation.
The page uses a normal --no-ff merge. If the selected directory is not
tracked by a Rove task, Land refuses. A dirty base checkout also refuses, as
does a branch with no commits ahead of the base (naming the uncommitted
files when the work was never committed), a detached-HEAD base checkout, and
a base already on the branch being landed. On a
merge conflict, Rove aborts the merge and reports the conflicted paths, leaving
manual conflict resolution to you.
A successful land removes the worktree — it is spent once its branch is in —
and the row leaves the page. The branch survives: git keeps the durable
record. Removal after a land is never forced, so it is refused by everything
a plain delete is refused by: the worktree is dirty, it holds gitignored work
git status cannot see (a HANDOFF.md, a .scratch/), that ignored listing
could not run, it is the base checkout, or it is the directory Rove itself is
running from. The land still stands and the page reports why the worktree is
still there. Deleting the
task and deleting the source branch remain separate lifecycle decisions;
from the CLI, rove api land --remove-worktree=false keeps the worktree.
A Task that spans several repos (add --repo A --repo B) lands from the CLI
(rove api land) as a unit with no atomicity: every repo is checked first and
nothing is merged if one refuses; then the repos merge in the order they were
picked, primary first, and the run stops at the first conflict. Earlier repos
stay landed, the conflicted one is aborted and clean, and running land again
resumes with the repos still unlanded (a repo already merged, or already
squashed onto its base, counts as having nothing to land). The worktrees are removed only after the last repo lands,
because the primary is the engine's working directory and the conflict is
resolved from it. rove api sync merges each repo's own base into its worktree.
Remove a clean worktree
- Select the worktree and press
d. - Confirm Delete worktree.
The row disappears while removal runs. If git refuses or the operation fails, the row returns. A successful removal deregisters and removes the working directory but keeps its git branch.
The page lists every registered worktree of a saved project, including
directories Rove did not create. Two of those it refuses to delete
(NOT_A_ROVE_WORKTREE): the directory a directory Task pins, and a project's
own checkout. Both are yours, not Rove's, and neither can be re-materialized
from a branch.
For a Rove-created worktree tracked by a Task, Rove clears that Task's worktree pointer. It does not delete the Task, its branch, or engine history. Opening the Task later may materialize a fresh worktree from the retained branch.
A Task that spans several repos (add --repo A --repo B) deletes as a unit:
the dirty / gitignored check covers every repo's worktree before anything is
queued (the refusal lists each repo that has work), a forced delete takes its
salvage snapshot in each repo, and a removal that fails in one repo leaves the
Task in deletion.phase = "error" naming that repo; already-removed repos are
skipped on retry. When a Task that owns extra worktrees is deleted while a
shared child survives, the child inherits them.
Downgrading is unsupported for such Tasks: a build from before multi-repo
drops extraRepos the next time it writes the task index, after which the
extra worktrees are unowned. Rove never deletes them; they stay visible in
git worktree list of their repo, and git worktree remove there clears them.
rove api remove-worktree --task-id ID [--force] is the same operation from a
shell, for scripting a reclaim of idle checkouts. It runs this path — session
teardown first, dirty refused without --force, salvage snapshot on every
force — and adds two refusals a clicking human cannot trigger: it will not
remove the project's own checkout (BASE_CHECKOUT) or the worktree the
command is running from (CALLER_WORKTREE).
rove api worktree-usage says which checkouts are worth reclaiming: every task's own
worktrees ranked by size, with the gitignored part (dependencies, build
output) broken out. --merged and --idle-days N narrow it to cleanup
candidates: tasks whose PR has merged, or that nobody has touched in N days.
rove api worktree-reclaim --merged (or --idle-days N) then removes those
candidates' worktrees in one go, keeping every task and branch. It never
forces: a checkout with work in it, a busy engine or your own worktree is
reported as skipped rather than removed. Add --dry-run first to see the
list.
The daemon also watches the disks your task worktrees live on. When one drops
below 5 GB free, every attached TUI shows a warning naming the free space, how
many worktrees share that disk, and the worktree-reclaim --merged --dry-run
command. It warns once per disk, reminds every six hours while the disk stays
low, and warns afresh only after free space climbs back above 8 GB.
When git removes the worktree but not its directory
git worktree remove does two things — deregister the worktree's metadata and
delete its directory — and they can fail apart. A path inside the tree that the
current user cannot unlink (a chmod -w directory, a read-only dependency
cache, a directory an external tool holds) makes the directory delete fail
after the deregistration has already landed.
Rove reports that as what it is. The removal counts as done — git no longer
knows this worktree, so no retry can advance it — and a notice names the
directory left on disk and git's own reason. A task deleted this way is
deleted, not parked in an error state, and the same line goes to
~/.rove/daemon.log next to the rest of the deletion trail.
Rove never deletes that directory for you: whatever made it undeletable may be something you want. Remove it by hand if you want the disk space.
On Windows the usual cause was Rove's own engine session: a process whose
working directory is inside the worktree keeps that directory undeletable,
and the removal used to start while the session was still exiting — and
ending it reached only the shell, not the engine it had launched. A deletion
now ends the whole process tree and waits for it to exit before
git worktree remove runs. A Permission denied residue after that means
something outside Rove holds a path in the tree (an editor, a running dev
server you started elsewhere).
Force-remove a dirty worktree
Dirty removal is deliberately two-stage:
- Press
dand confirm the ordinary deletion. - The daemon checks the worktree and refuses because it is dirty.
- Rove opens a second Force delete worktree? confirmation naming the branch and warning that modified and untracked files will be permanently lost. It lists the files the refusal found — the first ten, then a count of the rest — so you can see what is at stake before confirming.
- Confirm only after preserving anything you need.
The first confirmation can never silently turn into a force deletion. The second confirmation is the boundary that authorizes data loss. The branch is still retained, but uncommitted and untracked files are not part of it.
Step 2 checks more than git status --porcelain reports. A gitignored
HANDOFF.md or .scratch/ shows in no status output, so the check also asks
git status --ignored and refuses on any ignored entry under the 64 MB
per-entry budget below — the same budget the snapshot uses, so the delete
refuses for exactly what the forced retry then rescues. The refusal names
those paths, because git status will not. An ignored entry OVER the budget
(a node_modules/, a build directory) is not treated as work: it neither
blocks the delete nor lands in the snapshot.
If that git status --ignored cannot run at all, the delete is refused,
not allowed. An empty list is this gate's permission to destroy the directory,
so a listing that failed used to hand out that permission on the strength of
having failed. The refusal says the listing failed rather than naming paths,
and --force still overrides it — which is the safer order, because the
forced path takes a salvage snapshot first.
Landing with --delete-branch
land --delete-branch deletes the branch with git branch -D, which removes
the branch's reflog along with its ref — and the worktree removed just before
it held the only other reflog for that branch. After a --strategy merge
land that costs nothing: the merge commit on the base still reaches every
commit. After a --strategy squash land it would, because the squash writes
one new commit that has no link back to the branch's own commits.
So before deleting a branch nothing else keeps reachable, Rove writes its tip
to refs/rove/salvage/<branch>-<timestamp> — the same namespace as the
force-delete snapshots below, listed by the same command. rove api land
returns it as branchAnchor. Recover the pre-squash history with:
git log refs/rove/salvage/<branch>-<timestamp>
git branch <recovered-name> refs/rove/salvage/<branch>-<timestamp>No anchor is written when another ref already reaches the tip, which is the ordinary merge case, nor when no branch was deleted at all.
The delete needs the worktree to be gone first: git refuses to delete a branch
a live worktree has checked out. A land that kept the worktree — because you
passed --remove-worktree=false, or because removal was refused (dirty tree,
gitignored work, an ignored listing that failed, base checkout, the worktree
you are running from) — keeps the branch too, and reports it as branchKept
with the reason. Clear the worktree and re-run.
Recovering work a force delete destroyed
Before a forced removal, Rove snapshots what the removal is about to
destroy — modified tracked files and files you never git added — into a git
ref in the owning repo.
One force path takes no snapshot, because it cannot: a directory whose git
repo is unreachable at all. Snapshotting runs git inside the worktree, and
reaching that path means there is no repo to run it in. --force there is a
plain delete of a directory under a Rove worktrees root, with nothing to
recover afterwards.
Files matched by .gitignore are included too, but only up to 64 MB per
top-level entry. That threshold is the whole rule: a gitignored note or
scratch directory is kilobytes and gets snapshotted; node_modules/ or a
build directory is far larger and is skipped, because a snapshot carrying one
is too big to be useful. An ignored entry whose size cannot be read is
skipped. So a gitignored HANDOFF.md or .scratch/ is recoverable, and a
gitignored 200 MB dist/ is not.
One thing a snapshot cannot hold: a submodule or a nested worktree. git add
records those as a commit pointer rather than their files, so uncommitted work
inside one is in neither the snapshot nor the commit that pointer names. Rove
does not pretend otherwise — the audit line lists those paths as NOT captured, and the git restore commands below will not produce anything
under them.
List the snapshots, newest last:
git for-each-ref refs/rove/salvageThen inspect and restore from one, run inside the owning repository:
git show refs/rove/salvage/<branch>-<timestamp>
git restore --source=refs/rove/salvage/<branch>-<timestamp> -- path/to/fileThe snapshot's exact ref is also written to ~/.rove/daemon.log beside the
deletion's audit lines, with the recovery commands filled in — see
TROUBLESHOOTING for how to find the
deletion by task title and time.
The refs are ordinary git refs: they are not garbage-collected, and they are
never pushed. Delete one you no longer need with
git update-ref -d refs/rove/salvage/<branch>-<timestamp>.
Checkpoints
Every time an engine finishes a turn in a task's worktree, Rove saves a
checkpoint: a snapshot of the files as they stand, kept as a git ref in the
owning repo (refs/rove/checkpoints/<task>/<n>). It is the undo button for an
agent that went the wrong way, one step per turn.
A checkpoint holds tracked edits and files you never git added. Gitignored
files (node_modules/, build output, .env) are left out. It does not touch
your branch, your index or HEAD, and a turn that changed nothing takes no new
one. The newest 100 per task are kept. Only a task's own worktree is covered —
a directory task (a project's own checkout included) is your own files, and
gets no checkpoints. A nested repo or submodule is recorded as a pointer, not its
files; checkpoint reports those paths as uncaptured.
rove api checkpoint-list --task-id ID # what there is, oldest first
rove api checkpoint --task-id ID # take one now
rove api rewind --task-id ID --to 3 # restore the files to checkpoint 3rewind makes the worktree files equal checkpoint 3: files created since are
deleted, files deleted since come back, ignored files stay. The branch and the
agent's conversation do not move. It checkpoints the current state first and
prints that number as undo.n, so rewind --to <undo.n> puts everything back.
While the agent is mid-turn or waiting on a permission, rewind refuses with
TASK_BUSY; pass --force to override.
Checkpoints belong to the directory's owner. A child task that shares its
parent's directory has none of its own: its turns are recorded in the owner's
history, and --task-id <child> lists, takes and rewinds the owner's
checkpoints (replies say which task in workspaceTaskId). Because every task
in the directory edits the same files, rewind refuses while any of their
engines is working, not only the one you named.
A checkpoint is an ordinary commit, so the same history is reachable with git in the owning repo:
git for-each-ref refs/rove/checkpoints/<task>
git diff refs/rove/checkpoints/<task>/3
git restore --source=refs/rove/checkpoints/<task>/3 -- path/to/fileDeleting the task deletes its checkpoint refs; the worktree directory going away does not, since the refs live in the repo. If the owner is deleted while a child still uses the directory, the child inherits the history.
LayerFS tasks (experimental)
On a Linux machine with Docker, rove api add --workspace layerfs gives a task
a LayerFS Workspace instead of
a git worktree. The repo is imported into a LayerFS Store once (its .git
included), each task gets a Sandbox container of its own, and the Workspace is
mounted inside it at the same path the task row records. Every terminal Rove
opens in the task runs inside the container through docker exec, as uid
501:20 with HOME=/tmp/rove-home. On the host that directory holds only
.rove-launch.json (the docker exec prefix) and .rove-layerfs.json (the
backend's state).
Set experimental.layerfs in state.json to an env file of KEY=VALUE lines:
LAYERFS_CLI (the CLI's layerfs.js) and LAYERFS_NODE (the node that
runs it), plus the LayerFS settings LAYERFS_HOME, LAYERFS_STORE_PATH,
LAYERFS_IMAGE and whichever others your setup needs, all passed through
as-is. The Store lives under /var/lib/docker, so every LayerFS call runs
through sudo -n; without passwordless sudo the task is refused with
LAYERFS_NEEDS_ROOT. Build steps: workspace-runner.md.
What differs from a worktree task:
checkpointis a LayerFS commit of the whole tree,.gitand ignored files included, andrewindmounts a fork of that commit at the same path. Close the task's terminals first:rewindrefuses withWORKSPACE_BUSYwhile a process runs in the directory.- No checkpoint at turn end: engine hooks inside the container cannot reach
the daemon. Run
rove api checkpointyourself. - The task's branch lives inside the sandbox.
rove api export-branchcopies its commits into the host repo under the same name; land or push from there. - Engines see the container, not your machine: the engine CLI must be in the image, and logins, keys and host paths in its launch flags are not there.
- Deleting the task kills what still runs in its directory, then unmounts and closes the Sandbox. The LayerFS Branch stays in the Store.
- A Docker or machine restart ends the Sandbox and loses uncommitted work. The task does not remount; delete it and start a new one (committed state is still in the Store).
Troubleshooting
- Land says the worktree is not tracked. Adopt it as a Task first, or merge the branch manually.
- Land refuses a dirty base checkout. Commit the changes in the base
checkout, verify its current branch, then retry. Don't reach for
git stash: the stash stack lives in the repo's common dir (.git/refs/stash) and is shared by every linked worktree, so a stash here can entangle — or be popped by — parallel tasks' work. - Land reports conflicts. Rove has already aborted the merge. Resolve the branch relationship manually before retrying.
- A removed row comes back. The daemon operation failed or git still lists the worktree. Read the daemon log, correct locks or permissions, and retry.
- Remote state says unknown. Check
git remote -v, network access andgh auth status; the local dirty and branch facts remain valid.