[BUG] Claude worktree directory location is incredably frustrating
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
For some reason Claude is determined to collect worktrees in seemingly random folders. It used to put them inside the ./.claude folder which led some devs to attempt adding .claude/ to .gitignore and inevitably clobbered with other folders Claude puts in this folder.
Then it decided to put them in ./.claude/worktree/ or ./.claude/worktrees/ or ./.claude/.wt/ or ./.wt/ or ../.wt or ../worktree or ../worktrees. It never decides to put them in .. (the location I want to put them) unless I explicitly say to.
Now I have a full disk of worktrees to manually clean up because Claude doesn't seem to do so.
My directory structure right now:
~/Projects
- Repo1
- .claude
- worktree
- feature-slug
- feature2
- worktrees
- feature3
- .wt
- feature4
- .wt
- feature5
- .wt
- Repo1
- worktree
- feature6
- feature7
- worktrees
- feature8
- .wt
- feature9
- .wt
- feature10
- feature11
- feature12
- Repo1-feature13
(crosssed with 23 other repos which also have a bunch of stale worktrees)
What Should Happen?
- I want full control over the directory that Claude places worktrees.
- I want all my worktrees to exist as sibling directories to the repository.
- I want to be able to trust Claude to never create worktrees in a location where I am not looking for them.
~/Projects
- Repo1
- Repo1-feature-slug
- Repo1-feature2
- Repo1-feature3
- Repo1-feature4
- Repo1-feature5
- Repo1-feature6
- Repo1-feature7
- Repo1-feature8
- Repo1-feature9
- Repo1-feature10
- Repo1-feature11
- Repo1-feature12
- Repo1-feature13
Error Messages/Logs
Steps to Reproduce
I don't have specific steps to reproduce, basically any prompt to change something has claude making a change via a worktree. I just happened to open the folder and notice after not cleaning them up for a few weeks.
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.186
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗