Try ideas side by side in worktrees
A worktree is a separate copy of your project on its own branch. An agent can try an idea there without changing your project until you merge it.
A worktree is a separate copy of your project where an agent can try an idea, like a new look or a new page, without changing the original. The conversation keeps going in the copy, with everything it already knows. Your project’s main folder stays as it was until you merge the worktree into it.
How to start one
There’s nothing to set up. Ask your agent, for example:
- “Try a dark mode in a new worktree.”
- “Build the gift card page in a worktree.”
The agent moves the conversation into a new worktree and works there. A note in the conversation says “Moved into the dark-mode worktree, a separate copy of” your project “on its own branch.” From then on, a colored band at the top of the message box says “Working in dark-mode, a separate copy of” followed by your project’s name. The name is the worktree’s branch, which the agent picks unless you name one.
New worktree… in the branch menu explains the same thing. Worktrees need Git. See What are commits, branches, and pushing?
Where to find your worktrees
- The conversation list. Once any conversation works in a worktree, the list groups conversations by where they work. The group headed with your project’s name and main folder holds the conversations in your main folder. Each worktree gets a group of its own, in its own color.
- The branch menu. Under Worktrees, each one shows how many conversations work there, and whether one is working. A worktree with no conversations says A fresh copy, ready to go. Choosing one moves a conversation into it. See Move a conversation into a worktree.
Trying several ideas at once
Each conversation works in one place at a time. To compare ideas, give each one its own conversation and worktree. You can also ask an agent to start several conversations for you, each trying one idea in its own worktree. An agent can start up to five conversations for each request.
When you’re done
Like the result? Merge it into your project. If not, delete it. Both are on the band at the top of the message box and in the worktree’s menu in the conversation list. See Merge a worktree into your project and Delete a worktree.
Merging and deleting happen in the Enjoy computer app, on the computer that has the project. The web app and the iPhone app show worktrees, their bands, and their groups, but they don’t merge or delete them.
Good to know
- A new worktree starts from the commit your project is on, or from the branch’s latest commit if the agent reuses an existing branch. Changes that aren’t committed in the main folder aren’t in it, and neither are files Git ignores, such as installed packages. The agent may need to set those up again in the copy.
- Worktrees live in a .worktrees folder inside your project folder. Enjoy tells Git to leave that folder out of your main folder’s changes.
- Switching branches in the main folder doesn’t affect conversations in a worktree. They never show The branch changed.
- To bring a conversation back to the main folder, ask its agent: “Move back to the main folder.”
- Agents can only make worktrees when the project is opened from its main folder. If you added a worktree’s folder as its own project, its agents can’t make more.
If something goes wrong
When an agent can’t make a worktree, Enjoy tells the agent why, and it usually passes the reason on in the conversation. These are the reasons Enjoy gives:
- “… is checked out in the main project folder. Choose another branch name.” A worktree needs a branch of its own, and your main folder is already using that one. Ask for the worktree again with a different name.
- “Too many worktrees share this name. Choose another branch name.” Ask for the worktree with a different name.
- “Open the repository’s main folder to use worktrees.” The project you opened in Enjoy is itself a worktree’s folder. Open the main project folder instead, and make worktrees from there.