claude-code - 💡(How to fix) Fix Claude omits modified files when staging commits with new files

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

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.

RAW_BUFFERClick to expand / collapse

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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Claude omits modified files when staging commits with new files