[BUG] Bash tool: it keeps calling `git -C $PROJECT_DIR subcommand`

Resolved 💬 2 comments Opened Mar 1, 2026 by zzJinux Closed Mar 1, 2026

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?

The model intermittently returns git command executions with -C $PROJECT_DIR added. -C $PROJECT_DIR is effectively no-op in result and such command lines are not matched by the likes of Bash(git log *).

What Should Happen?

-C $PROJECT_DIR should not be added if it's not necessary at all.

Error Messages/Logs

Steps to Reproduce

I don't have concrete reproducible steps. It just happens from time to time.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.63

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

I've added this to CLAUDE.md but this doesn't prevent either.

Don't use `git -C $dir` if `$dir` is the worktree root of the $PWD.

---

I've asked Claude Code why:

-- user
This  forked session is to debug you.

why did you add `-C GIT_DIR`? Explain your reasoning.

-- assistant
 You're right to call this out. There was no good reason.

My CLAUDE.md instructions explicitly say:

Don't use git -C $dir if $dir is the worktree root of the $PWD.

The working directory is already /Users/edgar.jeong/code/wt/sendbird/sbgenai/aqua-arch.wt, so a plain git status --short
would have been correct. I added the -C flag needlessly, directly violating your instruction.

I don't have a defensible reasoning — it was a mistake. The first ls runtime/*.py command correctly used a relative path
without any issue, so I was already operating in the right directory. The -C on the git command was inconsistent with my
own behavior one line above.

View original on GitHub ↗

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