Free tools Windows power users keep installed
One-click scans. No signup required.
With one worktree per task, each coding task gets its own directory and—usually—its own branch, while Git keeps those worktrees attached to the same repository. An agent started in a task’s directory edits that checkout; its files do not appear in another worktree automatically. The separation is useful for concurrent work, but it is not a complete sandbox for services, secrets, databases, or dependencies.
What “one worktree per task” means
A Git worktree is a working directory connected to a repository. The Git project describes the arrangement this way: “A git repository can support multiple working trees, allowing you to check out more than one branch at a time.” A repository has one main worktree and can have additional linked worktrees.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
The Omarchy Way: How to Customize Omarchy Linux: Arch, Hyprland, Quickshell, and First-Class Agents... | $39.99 | Buy on Amazon |
As an Amazon Associate I earn from qualifying purchases.
Linked worktrees share repository data, but each has its own checked-out files and some per-worktree Git state, including its own HEAD and index. A linked worktree is therefore not another independent clone. At its top level, its .git is a file pointing to repository metadata, rather than a complete .git directory. Scripts or containers that use a linked worktree need access to the metadata path that file references. Git’s worktree reference documents the arrangement and commands.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Where does a coding agent’s work go?
The agent edits files in the directory where it is running. If it starts in a task-specific worktree, its file changes belong to that worktree’s checkout and, when attached to one, its branch. Other worktrees do not show those edits simply because they share the repository’s Git data.
#1 Best Overall
Once changes are committed, the commit is part of the shared repository data and can be integrated through the normal Git workflow. Until then, uncommitted changes remain in the worktree where they were made. A task-specific branch and directory make it easier to see which workspace owns a set of edits.
Should you use one worktree per coding task?
It is a practical choice when tasks need separate checked-out files—for example, when parallel coding sessions might otherwise modify the same checkout. Use a distinct branch for each task that will produce changes. Worktrees are not a guarantee that everything the task uses is separate: running servers, databases, secrets, package caches, and other services may still be shared, depending on your setup.
| Approach | Directory and branch | Git data | Setup and integration |
|---|---|---|---|
| Separate task worktree | Separate directory; can use a distinct branch | Linked to the same repository; some state is per-worktree | Local ignored files may need separate setup. Review and integrate changes using normal Git operations. |
| Another clone | Separate directory and repository checkout | Separate clone | Setup and integration follow your clone workflow. Disk or performance savings versus worktrees are not established by the cited documentation. |
| One shared checkout | One directory and active checkout | One working tree | Concurrent tasks operate in the same files, so their edits can collide. There is no separate worktree to integrate. |
The comparison describes the basic Git layout, not a measured performance or disk-usage result. A worktree may avoid maintaining another clone’s repository data, but dependencies, build outputs, and other files are determined by your project and setup.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Create a worktree and branch for a task
From the existing repository, run the following command, replacing the names and base branch with those used by your project:
git worktree add -b feature/task-name ../task-name main
Here, feature/task-name is the new branch, ../task-name is the worktree directory, and main is the starting point. Use the repository’s actual base branch or commit if it differs.
- Choose a clear task name. Reuse it in the directory and branch names so the mapping is easy to recognize.
- Create the worktree. Run
git worktree add -b <branch> <path> <start-point>from the repository, substituting the branch, directory, and intended base. - Start the agent in that directory. Verify its working directory before allowing it to edit files.
- Check local prerequisites. Identify ignored configuration files and local services the task needs; a new worktree does not guarantee they are present or isolated.
- Review and integrate. Inspect the task branch’s status and diff, then use your usual review and merge process.
- Clean up when finished. Inspect the worktree list and remove the linked worktree when its work is safe to remove.
Git can also create a worktree without creating a branch, including a detached worktree for testing or an experiment. For a task that needs its own branch, create one explicitly. By default, Git refuses to check out a branch already in use by another worktree; do not try to make two worktrees edit the same branch concurrently.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What is different about Codex app-managed worktrees?
These details apply to worktrees managed by the Codex desktop app, not to every Git worktree. According to OpenAI’s Codex worktree guide, a managed worktree is typically dedicated to one chat, while a permanent worktree is intended for a longer-lived project and can host multiple chats.
By default, Codex creates managed worktrees under $CODEX_HOME/worktrees. A managed worktree starts from the selected branch’s HEAD and uses detached HEAD. If that selected branch has uncommitted changes, Codex applies them to the worktree. The guide says the worktree root can be changed in Settings.
Ignored local files and handoffs
For local, app-managed worktrees, Codex supports a .worktreeinclude file to specify ignored paths to copy, such as .env or local configuration. Codex copies matching ignored files, skips source symlinks, and does not overwrite files already present. The documented behavior applies to local ChatGPT desktop app-managed worktrees; it does not describe remote worktrees or command-line worktrees created manually.
The guide also describes handing a chat between Local and Worktree, with the app handling the Git operations. Ignored files do not move in a handoff unless copied into a local managed worktree using .worktreeinclude. Because a branch cannot be checked out in two worktrees at once, use the app’s documented handoff flow rather than trying to check out the same branch in both locations.
Managed-worktree retention
OpenAI’s guide describes a default setting to retain the 15 most recent Codex-managed worktrees. This is an adjustable product setting, not a Git limit, and may change. The guide says Codex saves a snapshot before automatic deletion and can offer restoration when the chat is reopened.
Inspect, remove, or repair worktrees
Git provides commands to see and maintain linked worktrees:
git worktree listshows the worktrees associated with the repository.git worktree remove <path>removes a linked worktree. Git expects it to be clean by default; do not force removal without first understanding what uncommitted or untracked work would be lost.git worktree pruneclears stale administrative records after a worktree directory has been manually deleted.git worktree repaircan repair worktree links after a manual move when needed.
Prefer Git’s worktree commands over deleting directories casually: Git tracks linked-worktree metadata as well as the files in the directory. The exact options are documented in the Git worktree reference.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




