You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,3 +119,32 @@ Or source it in a shell script:
119
119
source .env.port 2>/dev/null || PORT=3000
120
120
echo"Starting dev server on port $PORT"
121
121
```
122
+
123
+
## Shared build cache across worktrees
124
+
125
+
Each worktree normally gets its own `node_modules`, `.venv`, or build output directory. This wastes disk space and install time. Use a hook to symlink these from a shared per-repo cache:
126
+
127
+
```toml
128
+
[hooks]
129
+
# Node.js — share node_modules via a central cache per repo
All worktrees for the same repo point to one `node_modules` (or `.venv`, or `target/`). The first `npm install` populates the cache; subsequent worktrees reuse it instantly.
146
+
147
+
> **Note:** Shared mutable caches work well for dependencies that are branch-independent. If branches use different dependency versions, consider per-branch cache keys instead:
0 commit comments