Command reference ยท Codex CLI
/worktree
Starts the chat in a new Git worktree.
/worktree starts the current chat in a new Git worktree instead of in the normal working directory. A worktree is an additional working copy checked out from the same repository with its own branch โ the agent's changes land there without touching your main branch. This way, multiple chats can work on the same project in parallel without interfering with each other; scheduled background tasks also run on their own worktrees according to the docs.
Important for you as a CLI user: according to the official docs, this worktree selection is only available in Codex within the ChatGPT desktop app (via the composer menu when starting a new chat), not in the pure terminal CLI. /worktree is listed in the general Codex command reference, but doesn't appear in the terminal CLI's own command list. In the pure terminal, git worktree add remains your manual option instead.
โ WHEN TO USE IT?
Let multiple chats work on the same repo in parallel without getting in each other's way
/worktree in the desktop app, while another chat keeps working on the main branch
Try out a risky refactor in isolation before it touches the main branch
/worktree, do the refactor in the new branch, only merge afterward
โ WHEN NOT TO?
You work exclusively in the terminal CLI
According to the docs, worktrees are only available in Codex in the ChatGPT desktop app; the terminal CLI doesn't know /worktree as its own command.
Better: work manually with git worktree add or switch to the desktop app
No Git repository present
A worktree requires a Git repo.
Better: stay in the normal workspace
SOURCES
- Codex CLI docs: Slash Commands โ learn.chatgpt.com
MORE COMMANDS ยท Codex CLI