Skip to content
BENIBIX Learn

.worktreeinclude

AI⌨️ Claude CodeConfiguration

Also known as .worktreeinclude file

The list of files a new worktree needs, like .env.

Think of it like

It is like a packing list for a trip. It says which things to bring along.

Example

Lucy's app will not start in a worktree, because .env is missing. She lists .env in .worktreeinclude, and new worktrees start fine.

Why it matters

Without it, each new worktree starts broken, since its secrets are not there.

Definition

.worktreeinclude is a file in a repo's root that lists the files to copy into a new worktree. Claude Code copies them each time it makes one. A worktree is a fresh copy of the repo, so files git skips, such as .env, are not in it. The file uses the same rules as .gitignore. Only files that match it and that git skips are copied.

Example code

console
.env
.env.local
config/secrets.json
Copy these three into each new worktree.

Common mistake

Listing a file git tracks. Tracked files are already in the worktree, so they are skipped.

Key takeaways

  1. 1
    Project root. One file.
  2. 2
    gitignore syntax. Patterns.
  3. 3
    Ignored files only. Tracked are skipped.