Concepts
File Sync
How rft syncs files to worktree directories
Automatic Sync
When you run rft start, rft automatically copies essential files to each worktree directory:
- Compose file (
docker-compose.ymlorcompose.yml) - Dockerfiles referenced in the compose file
.envfile (with port overrides injected)
These files are always synced regardless of configuration.
.env Handling
The .env file receives special treatment:
- The original
.envfrom the repo root is copied to the worktree - Port override variables are appended (or replaced if they already exist)
- Any
env_overridesfrom configuration are applied with${VAR}templates resolved
For example, if your .env contains:
DATABASE_URL=postgres://localhost:5432/myappAnd rft allocates ports for worktree #1, the worktree's .env becomes:
DATABASE_URL=postgres://localhost:5432/myapp
FRONTEND_PORT=23001
API_PORT=28081Custom Sync
Add extra files and directories to sync in your configuration:
sync = ["nginx/", "scripts/init.sql", "Makefile"]Directories are copied recursively. Paths are relative to the repository root.
env_overrides
Use env_overrides to inject computed environment variables that depend on allocated ports:
[env_overrides]
API_URL = "http://localhost:${API_PORT}"
CORS_ORIGIN = "http://localhost:${FRONTEND_PORT}"
WEBSOCKET_URL = "ws://localhost:${WS_PORT}"The ${VAR} placeholders are replaced with the actual allocated port values for each worktree. This is useful when services need full URLs, not just port numbers.