# Worktree Tools

> Two tools that move a session into a worktree and back.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** EnterWorktree, ExitWorktree, .claude/worktrees

## Think of it like

It is like going to a spare desk to try something. Then you go back to your own.

## Definition

Two tools move a session into and out of a git worktree. A worktree is a second copy of the project on its own branch. EnterWorktree makes a new worktree and moves the session into it. Or it moves into one that is already there. A new one, or one under .claude/worktrees, does not ask for permission. ExitWorktree leaves the worktree and goes back to the folder the session started in.

## Example

Jack is mid-way through a feature when a bug report comes in. Claude enters a new worktree, fixes the bug there, then exits back to the feature.

## Why it matters

Two jobs can go on in one project without their changes getting mixed up.

## Common mistake

Expecting a worktree to share uncommitted changes. Each one is its own copy, so unsaved edits stay where they were made.

## Three principles

- **Enter: new or old.** A second copy.
- **Exit: go back.** To where it started.
- **No prompt.** Under .claude/worktrees.

## Related terms

- [Worktree Isolation](https://learn.benibix.com/term/ai/worktree-isolation)
- [Branch](https://learn.benibix.com/term/development/branch)
- [Claude Code Session](https://learn.benibix.com/term/ai/claude-code-session)

## Taught in

- [Claude Code Session Tools](https://learn.benibix.com/learn/ai-claude-code/claude-code-session-tools): Claude Code, 11/16

![Tools that steer the session: ask a question, switch to plan mode, enter a worktree, run a skill, keep a task list.](https://learn.benibix.com/diagrams/ct-session-tools.svg)

---

Source: https://learn.benibix.com/term/ai/worktree-tools
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
