Branching a session into a copy you can take somewhere else, and going back to an earlier point. Subagents that start from your conversation are on the Subagents page.
Worktrees: create, set up, integrate and clean up isolated checkouts
| Question | Claude Codechecked at 2.1.300 |
|---|---|
| Fork a session | Inside a session,
A session started with flags the copy can't inherit, such as a replaced system prompt or a |
| Fork or rewind from an earlier point | Partly In the terminal,
|
| What the fork keeps | Every fork copies the conversation history up to the fork point. With |
| File changes and worktrees | Forking copies the conversation, not your files: Checkpoints don't cover changes made by Bash commands, most subagent edits, or symlinked and hard-linked files. A fork made with the SDK's |
| Where a fork came from | Partly
SessionStart hooks see |
| Fork from the SDK or API | Headless: For an unsaved fork, combine it with |