[BUG] Read tool returns "Unchanged since last read" after git checkout changes file content
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 Read tool's cache does not track file changes caused by git operations (git checkout, git reset --hard). After editing a file and switching branches with git checkout, if the file content happens to match what was previously cached (e.g., switching away and back to the same branch), Read returns "Unchanged since last read" instead of showing the file content.
This also causes the related Edit error "File has been modified since read" when the file content differs from the cache after a branch switch.
What Should Happen?
Read should always return the current file content. Git operations that modify files on disk should invalidate the Read cache.
Error Messages/Logs
● Read(/path/to/file.yml)
⎿ Unchanged since last read
Steps to Reproduce
- On branch
main, Read a file (e.g., a workflow YAML) - Create branch
feat/x, checkout to it - Edit the file (e.g., add a line) — Edit succeeds, Read cache is updated
- Run
git checkout main && git reset --hard origin/main— file reverts to original content on disk - Run
git checkout feat/x— file is back to the edited version (same content as step 3) - Try to Read the file → "Unchanged since last read" — file content is not shown
The cache compares step 3 (post-Edit) to step 5 (post-checkout) and sees them as identical, not realizing the file changed in between (step 4). The user never sees the file content and cannot proceed.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.96
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
Related: #42264 reports the same "Unchanged since last read" symptom triggered by conversation revert (/rewind). This issue documents a separate trigger path: git branch operations modifying files on disk without going through the Edit tool.
The root cause appears to be the same: the Read cache tracks content hashes but does not monitor filesystem changes from external processes (git, build tools, etc.).
✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗