Try ideas side by side in worktrees

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.
  • Files. In the computer and web apps, a chip beside Project files in the explorer names the copy you’re browsing: your main folder’s branch, or a worktree in its own color. The same name starts the folder path in Files home. Select either one, then choose a copy under Browse files in to see its files. Your documents are the same in every copy. See Browse and search your project’s folders.

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. To try another idea from the same point in a conversation, fork it and move the fork into a worktree before you send. See Fork a conversation. 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, and Files leaves it out of your main folder’s list. Choose a worktree under Browse files in instead.
  • 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.”
  • In a project inside WSL, worktrees that Git for Windows made in the project’s .worktrees folder, as earlier versions of Enjoy did, are repaired for the distribution’s Git the next time Enjoy reads the project’s worktrees.
  • 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.

In a project inside WSL, a worktree that Git for Windows made can’t always be repaired for the distribution’s Git. The project then shows one of these, with Git’s own reason:

  • “Enjoy couldn’t repair the worktree .worktrees/…, which Git for Windows made: …” Read Git’s reason, then ask an agent to repair that worktree with git worktree repair.
  • “Git for Windows made the worktree …, which Git in … can’t use. Repair it there with git -C … worktree repair …, then try again.” The worktree is outside the project’s folder, so Enjoy leaves it alone. Run the command the message gives in the distribution’s terminal.

See also

  1. 01Merge a worktree into your projectBranches & changes · 3 min
  2. 02Delete a worktreeBranches & changes · 2 min
  3. 03Move a conversation into a worktreeBranches & changes · 2 min
  4. 04Try ideas without risking your projectWorking well with Enjoy · 3 min
  5. 05What are commits, branches, and pushing?Branches & changes · 3 min

Did this help?

Service

If Enjoy doesn’t work as this manual describes, a person will help.