Worktree vs clone
A clone is a full copy of the repo. A worktree is an additional checkout linked to the same .git data, usually on a different branch, in a different directory.
| Single clone | Worktrees | |
|---|---|---|
| Disk | Duplicates objects | Shares object database |
| Branches | One HEAD at a time | One HEAD per worktree |
| Agents | Easy to collide | Natural isolation |
Naming branches and folders
Consistent naming helps humans and agents:
../my-repo-wt/agent-1-feature-x
../my-repo-wt/agent-2-fix-login
Pick a prefix directory (e.g. ../my-repo-wt/) so worktrees stay out of the main tree.
Safety
- Never run destructive Git commands across all worktrees from a single script without a dry run.
- Commit or stash before switching an agent to a new task on the same worktree.
- Delete stale worktrees when tasks are abandoned so disk and mental overhead stay small.
Agents and automation
Typical pattern:
- Agent receives a task id.
- Script calls Arbora (or raw
git worktree) to createwt/<task-id>. - Agent runs in that directory only.
- CI or you merge the branch when ready.
# Illustrative — exact flags depend on your Arbora version
arbora create agent-42-docs --branch docs/agent-42
cd ../my-repo-wt/agent-42-docs
# ... agent works here only
Adjust flags and paths to match your installed CLI; see the CLI reference.