Claude omits modified files when staging commits with new files
Resolved 💬 1 comment Opened May 31, 2026 by ityonemo Closed Jul 3, 2026
Description
When committing a new feature, Claude staged new files but failed to stage modifications to existing files that the new code depends on. This resulted in a commit that broke compilation after merge.
What happened
- User asked Claude to commit a new feature
- Claude staged NEW files (e.g.,
lib/foo/bar.ex) - Claude did NOT stage MODIFIED existing files (e.g.,
lib/foo.ex) that contained functions the new code calls - Pre-commit hooks passed (working directory still had unstaged changes)
- After merge, compilation failed with "undefined function" errors
Root cause
Claude used explicit paths when staging new files rather than reviewing git diff to identify all related changes. Modified files with required supporting code were left unstaged.
Expected behavior
Before committing, Claude should:
- Review
git difffor ALL unstaged changes related to the work - Verify staged changes are self-contained (no undefined function calls)
- Ideally test compilation of staged-only changes
Model
claude-opus-4-5-20251101
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗