Resume or continue a coding session in Claude Code
Learn how to resume, continue, search, and fork Claude Code coding sessions after interruptions.
Lesson Content
What happens when you are in the middle of a giant coding session, and your computer crashes or loses power? You might think you're out of luck, but Claude Code has a command that allows you to pick up right where you left off.
Resuming coding sessions
After starting Claude Code, type /resume. This will show you a list of previous coding sessions, and you can use your up and down arrows to pick a specific session to resume.
When in the Resume Session menu, you can also type / to search all previous conversations for a specific keyword. This lets you quickly find a previous session without scrolling through everything.
We can also resume a session right when starting Claude Code. Let's exit the resume functionality by tapping Esc a couple times, and then completely escape Claude Code by tapping Ctrl + C twice.
Then when starting Claude Code, pass in the --resume flag.
claude --resumeThis brings us right back to the Resume Session menu that we were just at.
Since we aren't loaded in Claude Code yet, we can tap Esc to go directly back to the bash prompt so we can look at one more feature, which is Continue.
From the prompt, type:
claude --continueThis immediately drops you into the Claude Code prompt with your most recent conversation from the current directory already loaded. There's no menu to pick from, so it's the fastest way to get back to what you were just working on.
You may notice there's also a /continue command inside Claude Code. Don't let this trip you up: it's just an alias for /resume, so it opens the exact same Resume Session menu. The difference between resume and continue only matters when starting Claude Code. Use --resume when you want to choose which session to load, and --continue when you just want to jump back into the last one.
Forking a coding session
There's also a related command worth knowing about. If you want to create a secondary conversation from an existing one, you can fork a coding session by typing /branch. This keeps your original conversation in-tact, but allows you to start new conversations that are branched from a previous one, and leaves your origin session unmodified.
You can do the same thing programmatically (when starting Claude Code) by combining the continue flag with --fork-session.
claude --continue --fork-sessionForking a session could be useful if you want to experiment with different prompts to compare output, evaluate various prompting techniques to see which works better, or create a base conversation to continue other conversations from. It's also a good idea to do this whenever you want to try out a different approach without losing or modifying the original session conversation.
Join the discussion!
Comments
Want to comment on this lesson?
Log in to leave comments.