Fork a session into a new branch
interactive sessions
// what it does
codex fork copies an existing transcript into a new session, leaving the original untouched, so you can explore an alternate approach without losing the thread. --last forks the most recent session, or pass a session id for a specific one; /fork does the same inside the TUI.
// shell
$ codex fork$ codex fork --last// gotcha
Fork branches the conversation, not your working tree — files Codex already wrote to disk stay as they are. Forking only gives you a fresh copy of the chat history to continue from.