[BUG] `claude --worktree` overwrites the `core.hooksPath` of `$GIT_COMMON_DIR/config`

Open 💬 10 comments Opened Feb 21, 2026 by zzJinux

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?

claude --worktree overwrites the core.hooksPath of $GIT_COMMON_DIR/config to $GIT_COMMON_DIR/hooks. This ends up as one of the following:

  1. If $GIT_DIR/config-core.hooksPath hasn't been specified, it's effectively no-op. Read https://git-scm.com/docs/githooks
  2. Otherwise, the core.hooksPath is overwritten, which is _destructive_ (if it points to some non-default path)

I guess that the original intention was to set the hooks for the newly created worktree to the main repo's one. But as I mentioned above, the actual behavior turns out to be merely modifying the $GIT_COMMON_DIR config. If it wants to touch the _worktree-specific_ thing, git config --worktree is the answer (which requires setting another config, though). But even git config --worktree is pointless since, if sharing hooks is the goal, it's already achieved by git-config resolution.

What Should Happen?

core.hooksPath of $GIT_DIR/config must be untouched when Claude Code creates a worktree internally (either by claude --worktree or EnterWorktree tool).

Error Messages/Logs

Steps to Reproduce

  1. Start with any repo with a custom core.hooksPath pointing to anything other than $GIT_DIR/hooks
  2. cd into the repo and execute claude --worktree
  3. Overwritten.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.50

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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