---
title: "Files to copy"
url: "/docs/reference/files-to-copy"
description: "Which gitignored files 10nx copies from the main checkout into a new worktree, and how to choose them"
---

# Files to copy

When 10nx creates a worktree, it copies gitignored files you name from the main checkout into it, so the worktree has your `.env` and other local config without you copying them by hand. Committed files are already there, from git.

Use this page when a new worktree is missing a local file, or when you want to copy more than `.env` files.

## Choosing the files

Two places, and the first one found wins:

1. **`.worktreeinclude`** at the main checkout's root, one pattern per line. If the file exists it's used, even if it's empty. It's the same file Claude Code reads, so one list serves both.
2. **`files_to_copy`** in the settings files. Default: `[".env*"]`.

```toml
files_to_copy = [".env*", "config/local.yml", "certs/"]
```

```bash
# .worktreeinclude
.env*
config/local.yml
certs/
```

## The rules

- Patterns use `.gitignore` syntax: `*` and `**`, a leading `/` to anchor to the root, a trailing `/` for a folder.
- **Only gitignored files are candidates.** A committed file is never copied, since git already put it in the worktree.
- **Nothing in the worktree is overwritten.** A file that's already there is left as it is.
- **Heavy folders aren't searched:** `.git`, `node_modules`, `.venv`, `venv`, `__pycache__` and cache folders. A pattern that names one of them on purpose (`node_modules/`) copies the whole folder.
- `.claude/worktrees/` itself is never copied.

## When it runs

Right after the worktree is created and before the setup script, so the script can rely on the files. **Run setup** on an existing worktree copies whatever's missing.

## Next steps

- [Scripts](scripts.md): the setup script that runs next
- [Set up a repo for worktrees](../guides/set-up-worktrees.md)
- [Settings reference](settings.md#worktrees)
