dotsfeed
← Updates

Codex

New Codex worktree missing your .env? Add a .worktreeinclude file so the desktop app copies it over

Verified· Oct 20, 2026Published Oct 20, 2026

Yes: add a .worktreeinclude file at your repo root listing Git-ignored files like .env, and the Codex desktop app copies them into each new local worktree.

What changed

Codex in the ChatGPT desktop app can copy Git-ignored local files into the worktrees it creates for you. Put a .worktreeinclude file at your repository root and list the ignored paths (or .gitignore-style patterns) a fresh worktree needs, one per line. When Codex creates a local managed worktree, it copies the matching ignored files in. OpenAI's own Codex repo uses it to carry over a local user.bazelrc.

Who is affected

Anyone running Codex Worktree chats in the ChatGPT desktop app whose project only runs with local, untracked setup files such as .env, .env.local, or a local config JSON. It does not apply to remote worktrees or to worktrees you create yourself with git worktree.

What to do now

  1. Check which local files your app needs but Git ignores (git check-ignore -v .env confirms a file is ignored).
  2. Create .worktreeinclude at the repo root, for example:
.env
.env.local
config/dev.local.json
  1. Start a new local Worktree chat and confirm the files are there before Codex runs your tests.
  2. List only ignored files. Tracked files are already in the checkout, and ordinary untracked files are not copied. You don't need to list an ignored AGENTS.override.md; Codex copies it automatically.

What is not confirmed

Codex skips source symlinks and won't overwrite a file that already exists in the new checkout, so a stale copy stays stale until you delete it. OpenAI's docs describe this for the desktop app; we have not tested it on every platform the app runs on. If your files hold secrets, remember each worktree gets its own copy.

Sources: tip by @MarMarLabs on X (https://x.com/MarMarLabs/status/2112673677883940888), checked against OpenAI's Worktrees docs (https://learn.chatgpt.com/docs/environments/git-worktrees) and openai/codex PR #31271 (https://github.com/openai/codex/pull/31271).

Sources

Get updates like this every morning

  1. ① Email
  2. ② Card on Stripe
  3. ③ 7 days free

Then $2/month · cancel anytime in one click

New Codex worktree missing your .env? Add a .worktreeinclude file so the desktop app copies it over · Dotsfeed