Isolate a task with a worktree
Create a separate task directory in Onevium, choose starting branches and nested repositories, and review changes before merging them.
Your workspaceA worktree is another working directory for the same Git repository. Use one to let AI try changes while keeping your work in the original directory. An ordinary local conversation uses the original directory; a new worktree task gets its own directory and branch.
1. Start a worktree conversation#
- Create a new conversation in the intended project and check its path.
- Enable Worktree on the right of the project and branch row beside the composer (Figure 1).
- Click Start from. Usually, keep Current branch; choose Other branches… for a different starting version. Select Include uncommitted local changes only when you want to continue edits that have not been committed in the original directory.
- Send the first message. Onevium now creates the directory and a
onevium/…branch, prepares the workspace, and starts the task.
Figure 1: Enable Worktree on the right, then choose a starting point on the left. Real 1.2.4 development components with sample project data; no task has been sent.
For a first try, send:
Check the working directory and Git branch.
List the included repositories.
Tell me which copy this task will edit.
Do not edit any files yet.
Continuing this conversation reuses its worktree; each message does not create another one. Onevium remembers the project's Worktree setting, so check it when starting your next conversation.
2. Include repositories inside the project#
Suppose your project folder contains two independent Git repositories: app and website.
- Enable Worktree, then click Start from or Choose repositories.
- Under Repositories, select the ones this task needs (Figure 2). Select only
websitefor a website change, or both for work across the application and website. - Under Start point, click each repository to choose its starting branch. Including uncommitted changes is also a separate choice for each repository.
Figure 2: Select repositories above, then set their starting points below. The same development UI demo uses sample app and website repositories.
Onevium creates a worktree for each selected repository, preserving its relative location in the new directory. The repositories remain independent: commit and merge each separately.
| Project structure | What gets created |
|---|---|
| The project root is a Git repository | The root repository is always included; independent nested repositories are added when selected |
| The project root is an ordinary folder containing repositories | Select at least one repository; a sole repository is selected automatically. Ordinary files in the original folder are not copied wholesale |
| A nested repository is not selected | It stays out of the new worktree; its original directory remains in place |
Independent nested repositories are different from Git submodules, which are not checked out automatically. If a repository you need is missing from the list, open that repository's directory as a project directly.
3. Check the result and keep your changes#
Once preparation finishes, the conversation shows Worktree · branch name. Verify the actual path and branch in the conversation before editing. Use Files, terminal, and Review to inspect file changes.
Finishing the task does not merge changes into the original branch. Review the diff and run the project's checks, then explicitly ask the assistant to commit and merge into your chosen target branch. Handle each repository separately.
To compare two approaches, start two separate worktree conversations. Continuing or adding a conversation inside an existing worktree shares that copy of the files. Split view does not create additional isolation.
4. Clean up and restore#
- Open Settings → Worktrees → General. Find the target under Managed worktrees, make sure your work is kept, then click Delete (Figure 3). Automatic cleanup only removes older worktrees without unsaved changes.
Figure 3: Click Delete beside the target worktree. Real development UI components with sample project data and paths.
- Read the confirmation dialog (Figure 4). If there are unsaved changes, confirm that a snapshot can be created. If it cannot, cancel and keep your files first. Manual deletion also archives linked conversations.
Figure 4: Check the snapshot and archiving information before deleting. This demo only opens the confirmation dialog; nothing was deleted.
Git-ignored local configuration, such as .env.local, is not included in snapshots; keep it separately.
- To recover the worktree, open its original conversation, click Restore worktree (Figure 5), and wait for setup to finish. If the conversation is archived, first go to Settings → Archived sessions and click Restore, then open it.
Figure 5: Click Restore worktree in the original conversation. The same development UI demo uses a sample path.
Deleting or restoring a worktree does not merge its code.
Troubleshooting#
| Symptom | What to do |
|---|---|
| No Worktree switch | Check that Git is available and the project is, or contains, a Git repository; an empty folder alone is not enough |
| Edits from the original directory are missing | Start from the current branch and select Include uncommitted local changes when creating the worktree; an existing worktree does not sync live with the original |
Dependencies or .env configuration are missing | Install dependencies in the new directory using the project instructions. List needed Git-ignored configuration in .worktreeinclude at the relevant repository root to copy it into newly created worktrees |
| The environment script fails | Click View log in the creation progress and fix the reported environment issue; a created directory does not prove the project can run |