Learning resourcesReviewed · OpenAI

Codex Worktrees Guide

This guide helps developers run parallel Codex coding chats, but worktrees require Git and need their own development setup. It explains separate checkouts, Handoff between working locations, branch restrictions, ignored-file copying and automatic cleanup.

Researched 25 Nov 2026

In short.

This guide teaches developers to manage parallel Codex coding chats, but separate worktrees require Git and do not automatically receive every local setup file. It explains creating worktrees, moving chats and code through Handoff, copying selected ignored files and managing cleanup. Its practical value is helping developers choose where to inspect and verify changes. Pricing, version compatibility and operational reliability are not established; nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected Worktrees page at [https://learn.chatgpt.com/docs/environments/git-worktrees.md], including setup, mobile-control limits, Handoff, branch restrictions, ignored-file inclusion, cleanup and FAQs. Linked pages about Git, mobile use, local environments, scheduled tasks and the documentation index are excluded. Illustrations were represented by captions in the supplied text; their visual contents were not assessed. No commands or resource behavior were executed. Performance, operational reliability, version compatibility, pricing and redistribution rights remain unestablished.

The overview

Identity

Worktrees is a documentation guide for the Codex feature that gives coding chats separate working copies of a project. Its source address is [https://learn.chatgpt.com/docs/environments/git-worktrees.md].

The guide covers the ChatGPT desktop workflow and explains how the mobile app can control worktree chats on a connected computer. Repository files and commands remain on that computer or its remote development environment.

Assessment

The guide is useful for developers who want Codex to work on separate tasks while keeping their foreground checkout available. It supplies actionable interface steps and explains consequential details such as branch ownership, ignored configuration files and worktree deletion.

The main practical question is whether each worktree has the dependencies and tools needed to review changes there. The documented separation concerns repository checkouts; isolation of running services, ports or external systems is not established.

Users

The guide suits developers running several Codex chats, people queuing background coding tasks and developers who want to preserve their usual local development environment. Beginners receive definitions of a checkout, worktree and Handoff; experienced developers receive details about detached HEAD, branch restrictions and file inclusion.

Mobile users need access to a connected computer. Someone working on a project outside Git cannot use the worktree workflow described here.

Capabilities

The page describes starting independent coding chats in worktrees, choosing their starting branches and moving a chat and its code between Local and Worktree through Handoff. A chat normally returns to its associated worktree when handed back.

It also covers opening a worktree in an IDE or integrated terminal and creating a branch before committing, pushing and opening a GitHub pull request. Scheduled tasks can use dedicated background worktrees in Git projects; in projects without version control, scheduled tasks run directly in the project directory.

Using it

Requirements

The selected project must belong to a Git repository. The desktop instructions apply on the computer containing the project or using its remote development environment. The mobile app guides work on that connected computer rather than running a worktree on the phone.

A usable development environment must be available wherever changes will be checked. The page suggests local environment setup scripts but does not include their instructions. Supported operating systems, minimum Git and app versions, and account-plan eligibility are unknown.

Mechanism

Each worktree has separate repository files while sharing Git commit and branch metadata with the original checkout. Codex starts from the selected branch's HEAD commit, meaning the commit that branch currently references. If a branch with local changes is selected, Codex also applies those uncommitted changes.

Managed worktrees start in detached HEAD, where the checkout is not attached to a named branch. Creating a branch gives the work a branch name, but Git permits that branch to be checked out in only one location at a time. Handoff is documented as managing the Git operations required to move the chat and code between checkouts.

Setup

Select Worktree under the new-chat composer, optionally select a local environment, choose the starting branch and submit the coding request. Then continue in the worktree or use Hand off in the chat header to move to Local. Choose Create branch here when continuing toward commits and a pull request from the worktree.

For ignored setup files needed in local managed worktrees, create a repository-root .worktreeinclude containing ignored paths or .gitignore-style patterns. The examples include .env, .env.local and config/secrets.json. Only matching ignored files are copied; other untracked files are not. An ignored AGENTS.override.md is copied automatically.

Managed worktrees default to $CODEX_HOME/worktrees. Settings > Worktrees allows changing the Worktree root.

Example

An illustrative workflow is to keep a development server running in Local while asking Codex to fix a form in a worktree based on main. With the necessary dependencies installed in the worktree, the developer could inspect and verify the change there, create a branch and prepare a pull request.

If verification requires the existing local server, the documented route is to hand the chat to Local. Trying to check out a branch locally while it remains checked out in the worktree encounters Git's branch restriction. This scenario has no execution results.

Assessment & evidence

Limitations

A branch cannot be checked out simultaneously in Local and another worktree. Ignored files do not move through ordinary Git operations; the documented .worktreeinclude copying behavior applies specifically to local desktop-managed worktrees, excluding remote worktrees and worktrees created manually through Git. Copying skips source symlinks and does not overwrite existing destination files.

Managed worktrees can be deleted when their chats are archived or when older worktrees exceed the configured retention limit. The page says pinned chats and chats still in progress are protected from automatic cleanup. Before deletion, Codex saves a snapshot and offers restoration when the chat is reopened; restoration reliability and snapshot retention duration are not established.

Permanent worktrees from earlier versions remain protected from automatic cleanup, but the project menu no longer creates them.

Reasoning

Separate file copies make this workflow a practical fit when background coding tasks need their own working files while foreground development continues. Shared Git metadata means branch coordination still matters, and separate checkouts require attention to dependencies, configuration and disk use.

The decision between staying in a worktree and handing off to Local should follow where the changes can be inspected and verified. The page supplies no evidence that parallel chats improve code quality or finish tasks faster.

Alternatives

Working directly in Local is the documented option when the existing IDE setup or development server is needed. Staying in a worktree suits a checkout with its own working dependencies and tools.

The page also refers to Git worktrees created manually from the command line. Their creation procedure is not included, and the documented local managed-file copying behavior does not apply to them. Other coding assistants and competing development tools are not compared.

Evidence

The evidence is the complete Worktrees documentation page at [https://learn.chatgpt.com/docs/environments/git-worktrees.md]. It supports the described interface steps, Git behavior, file-copy rules and cleanup defaults.

The page provides documentation rather than measured performance or independent reliability results. Nothing was executed: worktree creation, Handoff, file copying, branch operations and snapshot restoration remain untested.

Access & freshness

Costs

The page states no subscription price, usage allowance, token charge or separate worktree fee. Monetary cost and any required paid plan are unknown.

Storage is a documented overhead: each worktree can contain repository files, dependencies and build caches. The default retention limit is the most recent 15 managed worktrees, with settings to change the limit or disable automatic deletion. Disk requirements and setup time are not quantified.

Rights

The page supplies no explicit license or redistribution permission for its text or examples. Those rights remain unknown from this evidence. Codex usage terms and ownership terms for generated work are also not established by this page.

Freshness

The available page snapshot was captured on 25 November 2026. The page itself supplies no publication date, last-updated date or applicable app version.

Its controls and defaults describe the captured documentation. Compatibility with particular installed releases and changes after capture are unknown.

Actions

Confirm that the project uses Git, then decide whether changes can be verified in a separate checkout or need the existing Local environment. Identify required dependencies and ignored configuration before starting a worktree. Review any credential-bearing files before including them through .worktreeinclude.

Choose the starting branch deliberately. Use Handoff when moving work to Local, and create a branch when preparing commits from the worktree. Review storage and retention settings before accumulating worktrees, and check account eligibility and pricing separately because this page does not establish them.

Evidence for this report

selected-page.txtselected · checked 2026-11-25