How to Fork a Claude Code Conversation (/branch and /fork)

To fork a conversation in Claude Code, run /branch inside a session.

It copies the conversation so far and switches you into the copy, so you can try a different approach while the original stays untouched.

There’s also /fork and a --fork-session flag, and they behave a little differently.

This article explains all three options and how to get back to the original conversation.

Which one should you use?

OptionWhat it does
/branchCopies the conversation and switches you into the copy
/forkCopies the conversation into a new background session, while you keep working in the original
claude --continue --fork-sessionStarts a new session from the command line as a copy of your last conversation

Fork with /branch

Run /branch with an optional name:

/branch try-streaming-approach

If you don’t give a name, Claude Code names the branch after the first prompt in the conversation.

The confirmation shows two session IDs: the new branch you’re in and the original. The original is saved unchanged.

Here’s what carries over to the branch:

  • Conversation history: everything up to when you ran /branch
  • Permissions: the “allow for this session” approvals you gave still apply
  • Background tasks: they keep running, and their output appears in the branch

Fork with /fork

/fork copies the conversation into a separate background session, so both can work at the same time. You stay in the original.

You can give the copy a task right away:

/fork try rewriting the parser with a state machine

Without a prompt, the copy waits for its first instruction. Unless the copy is set to edit files in place, Claude Code tells it to work in its own git worktree, so the two sessions don’t change the same files.

Fork from the command line

To start a new session that’s a copy of your last conversation, combine --continue with --fork-session:

claude --continue --fork-session

You can also use --resume instead of --continue to pick which conversation to copy.

This copy runs in a new process, so you’ll need to approve permissions again.

How to switch back to the original

Run /resume and pick the original from the list, or pass its name:

/resume <original-name>

The session IDs from the /branch confirmation also work with /resume. All your sessions are saved in the same place, which I cover in where Claude Code sessions are stored.

Don’t resume one session in two terminals

If you open the same session in two terminals without forking, messages from both get mixed into one conversation. Fork first if you want to work on two things at once.

Fork vs rewind

Forking keeps both versions of the conversation. If you just want to go back and try again without keeping the current path, rewind instead. See how to undo changes in Claude Code.

Conclusion

Use /branch to try a different direction while keeping the original, /fork to run a copy in the background at the same time, and claude --continue --fork-session to fork from the command line.