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

  1. User asked Claude to commit a new feature
  2. Claude staged NEW files (e.g., lib/foo/bar.ex)
  3. Claude did NOT stage MODIFIED existing files (e.g., lib/foo.ex) that contained functions the new code calls
  4. Pre-commit hooks passed (working directory still had unstaged changes)
  5. 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:

  1. Review git diff for ALL unstaged changes related to the work
  2. Verify staged changes are self-contained (no undefined function calls)
  3. Ideally test compilation of staged-only changes

Model

claude-opus-4-5-20251101

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗