I use git worktrees a lot, and I’ve been annoyed by the repo itself having effectively a privileged worktree that’s always there (and refuses to let any other worktree check out the branch it’s on). And then not having a good place to put my other worktrees. If I clone to $PROJECTS/this-project
, where do I put my worktrees?
- If I put them in the directory, the worktree directories are scattered among all the files in the clone’s working tree (and I seem to remember git having some issues with worktrees inside a working tree), but
- if I put them next to the directory, then the worktree names need to be prefixed with the repo name (and if there are repos
foo
and foo-charts
, it’s easy to forget that foo-charts
isn’t just a worktree of foo.
So, my projects tended to look like this:
$PROJECT_DIR
├── my-project # a repo
│ ├── .git
│ └── ... # but also a working tree