Resume, Branch and Rename
Level 2 · Inside a conversation
The commands that end, name, find and split a conversation. /clear, /resume, /branch and /rename inside, and --name, --resume and --from-pr at launch.
Course contentsLesson 4 of 17
Level 1 · Get started
Level 2 · Inside a conversation
Level 3 · Parallel work and review
Level 4 · Setup and extensions
Level 5 · Scripts and servers
After this lesson you can
- Name a session so you can find it later
- Split a chat with /branch to try an idea
- Find the session that wrote a pull request
11 mincovers 9 glossary entries
Worth reading first: Claude Code Login Commands
How to end, name, find and split a conversation
Every Claude Code conversation is saved to disk, so it can be found again. Inside a session, /clear starts a new one and keeps the old, /resume opens an old one, and /branch splits the one you are in. In the shell, claude --resume, or -r, does the job of /resume. A name of up to 200 characters makes all of them easier.
/clear empties the chat so Claude starts fresh on a new task. CLAUDE.md and your project memory load again. Pass a name, such as /clear login-fix, and the old chat gets that label in the /resume list. /reset and /new are other names for it. /exit, or /quit, closes Claude Code, and the chat stays on disk.
Names are how you find things. claude -n login-fix starts a session with a name, and the name shows in the /resume list and the terminal title. /rename changes it in the middle of a session and puts it on the prompt bar. With no name, /rename makes one up from the chat.
/resume with no name opens a list of past sessions, and background ones are marked bg. With a name or an ID, it opens that one at once. /continue is another name for it. Given an ID, claude --resume looks in this project and its worktrees first, then in every other project on the computer.
A script wants an ID it knows ahead of time. --session-id starts a session with one you pick. It must be a UUID, a long code in a fixed pattern of letters and numbers. The script can then resume that exact session later without reading any list. A person is better served by a name.
/branch copies the chat at this point and moves you into the copy. The original stays as it was, and /resume takes you back to it. Both copies work on the same files. So a branch tries a new line of talk, not a new set of edits. --fork-session does the same when you resume from the shell.
--from-pr finds sessions by the pull request they worked on. Give it a number, or a link from GitHub, GitLab or Bitbucket. When Claude opens a pull request, the session is linked to it on its own. So a review comment three weeks later can lead straight back to the chat that wrote the code.
claude -n login-fix
claude --resume login-fix
claude --from-pr 123
claude --session-id "550e8400-e29b-41d4-a716-446655440000"Worked example
Emma tries a second idea in one chat
Emma has spent 40 minutes on a slow page with Claude. She wants to test a cache idea without losing the thread, so she runs /branch try-cache.
The idea fails. She runs /resume and picks the original, and all 40 minutes of talk are there. The cache edit is still in her files, since both chats share them, so she undoes it with git.
The words for this lesson9
Check yourself
You run /branch, edit a file in the copy, then /resume the original. Where is the edit?
Finished this lesson?
Marking it complete also marks its 9 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.