[FEATURE] Change default worktree dir to `.git/tmp`

Resolved 💬 5 comments Opened Mar 24, 2026 by kpgalligan Closed Mar 26, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When using claude --worktree, the repo is placed in .git/worktrees. When finished with the work there, I merge those changes into the parent repo and close the worktree.

However, if you run git add . in the parent before the worktree is removed, git will add it as a sub repo, with all of the problems that carries with it.

Proposed Solution

Put the worktree folders in .git/tmp. git will ignore the child repo folder when performing operations on the parent.

This is how Git Subrepo operates, for a live example.

Alternative Solutions

Related to https://github.com/anthropics/claude-code/issues/27282. If worktree paths were configurable, I'd configure .git/tmp.

Priority

Low - Nice to have

Feature Category

CLI commands and flags

Use Case Example

  1. claude -w some-feature
  2. claude -w some-other-feature
  3. Do some work in those folders that creates conflicts
  4. Merge some-feature back into the parent repo, then delete the worktree
  5. Merge of some-other-feature fails because of conflicts. Resolve them.
  6. Run git add . to wrap up merge.
  7. some-other-feature repo folder gets added as a sub repo...

If some-other-feature were in .git/tmp/some-other-feature, it would not be added.

Not a show-stopper, but I've accidentally added the worktree folder more than once.

Additional Context

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗