What worktrees are

A worktree is a second checkout of a project’s git repository, in its own folder, so a chat can change files without touching the checkout you’re working in. Tadle Code X makes and removes these folders itself.

Start work in a worktree

  • Fork a chat into one: in the chat’s menu, choose “Fork”, then “Fork into new worktree”. /fork in the message box offers the same choices. The project must be a git repository. Your uncommitted changes go with it; if they can’t be carried over, the worktree isn’t created.
  • Keep one as a project: in the project’s “…” menu in the sidebar, choose “Create permanent worktree”. It starts from your current commit, or from its upstream if that’s ahead, without uncommitted changes, and stays until you delete it.

For now, the message box can’t start a chat in a new worktree, and a chat can’t be handed off to one.

On this computer, files your repository ignores aren’t copied into a new worktree unless they match a .worktreeinclude file at the repository’s root. Ignored AGENTS.override.md files are always copied. When you fork into a worktree, the selected local environment’s setup script runs there. A permanent worktree runs none.

Create a branch

A new worktree isn’t on a branch of its own. When you commit, or choose “Create branch”, the app first asks you to create one in the “Work here” dialog.

  1. Check the branch name. The app suggests one from the chat’s title, after a prefix: tadle/, unless you change it in Settings, under “Git”.
  2. Choose “Create”. The app creates the branch for the worktree. If the name is already taken, it says “Branch already exists”.
  3. The app then goes on with what you started: the commit, or the pull request. After “Create branch”, it opens the commit dialog.

If the worktree has no branch when you create a pull request, the Create PR dialog names and creates one for you. In that dialog, choose “Create draft PR”, “Create PR” or “Open PR in browser”.

Creating a pull request needs the GitHub CLI (gh) installed on your computer and signed in with gh auth login. The app creates pull requests through it, not through a GitHub account of its own.

Remove a worktree

  • Settings, under “Worktrees”, lists them. “Delete” doesn’t ask you to confirm: it archives the worktree’s chats and removes its folder. Branches you created are kept. If the local environment has a cleanup script, it runs first, and if it fails, the worktree isn’t deleted and the app says “Failed to delete worktree”; its chats stay archived.
  • Archiving a chat also removes its worktree, unless the worktree is kept as a project or a fork of the chat still uses it. No setting turns this off.
  • Old worktrees are removed automatically. By default the app keeps 15 and removes older ones without asking, sparing pinned and running chats and worktrees kept as projects. You can change this in Settings, under “Git”, with “Automatically delete old worktrees” and “Auto-delete limit”.
  • Before removing one, the app saves a snapshot, and the chat offers “Restore worktree”. A snapshot leaves out files your repository ignores. When you delete a worktree in Settings, the removal goes ahead even if the snapshot fails; when it’s removed because you archived a chat, or automatically, a failed snapshot keeps the worktree. Commit work you want to keep.

Before you rely on one

A worktree keeps a chat’s changes apart from your checkout. It isn’t a security boundary.

Back to the documentation.