↓ Skip to main content
  1. Tags/

File Systems

2026

When git add Exits 0 but Stages Nothing: Debugging Git Stat-Cache
Technical Practice · 2026-10-09 · 7 分钟

When git add Exits 0 but Stages Nothing: Debugging Git Stat-Cache

When writing automation scripts or working in the terminal, developers assume a simple rule: as long as git add <file> exits with code 0, the change is staged. Today, while updating author metadata on the blog, I hit an elusive silent failure: real file modifications on disk, git diff clearly printing the hunk, git add returning 0, yet git status stubbornly insisting the file was untracked, with git diff --cached remaining completely empty.

1356 字 阅读 ➔