brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: claude with fork-session resumes a Claude Code session as a copy

Claude
~/tips/tip-claude-fork-session-resume

claude --resume auth-refactor --fork-session

Continues from an old conversation under a new session ID, so the original stays untouched.

Resuming a session continues it: every new message lands in the same history. Sometimes you want to try a different direction from that point and keep the original clean.

claude --resume auth-refactor --fork-session
claude --continue --fork-session

--fork-session works together with --resume or --continue. You get the whole conversation up to that point, but under a new session ID. Whatever you do next is stored in the copy. The original session stays exactly as it was, and you can still resume it later.

It also works in scripts. Two claude -p runs that resume the same session with --fork-session each get their own copy, which I think is a neat way to ask two different follow-ups from one shared starting point.

Inside a running session, /branch does the same thing without leaving.

The fork copies the conversation, not your files. If the original session edited code, the fork starts with the files as they are on disk now. Two forks editing the same working tree will step on each other. For parallel work on code, give each one its own git worktree.

Further reading: CLI reference, Commands: /branch

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link