Hacker News new | ask | show | jobs
by nullderef 1 day ago
I haven’t hit these issues when using worktrees. But what’s a pain is having to compile from scratch every time, and not carrying over gitignored files.
4 comments

I set up a custom hook in Claude which runs my own worktree creation/cleanup script, which takes care of copying my node_modules into the worktree, my .env (plus doing some edits to the .env to isolate it so it can run in parallel), and stuff like that. Each worktree gets its own docker compose project name so they can run docker stacks in parallel. Works pretty seamlessly.
Same here, over hundreds of worktrees in months of work.

The only problem I ran into was when Codex or Claude Code were configured to create the worktrees nested into the parent repository.

Then grep would yield results from a worktree and the agent would happily start to work in the wrong worktree.

.worktreeinclude is probably part of the solution.

https://code.claude.com/docs/en/worktrees#copy-gitignored-fi...

look into .worktreeinclude