Regression in `git diff --quiet HEAD` when a new file is staged
- From
- Jake Zimmerman <jake@zimmerman.io>
- Date
- Oct 17, 2025, 00:09 UTC
- Message-ID
- <CACJRbWjwOQwJB13CwTfvhV3p+Hbn4KrNM9AtBanGtUS4V_1MbQ@mail.gmail.com>
In git v2.51.1, `git diff --quiet HEAD` will actually print something if the diff output includes a new, staged file.
## To reproduce
❯ mkdir foo
❯ cd foo
❯ git init .
Initialized empty Git repository in /Users/jez/foo/.git/
❯ gc --allow-empty -m "Initial empty commit"
[master (root-commit) 858966f] Initial empty commit
❯ touch foo.txt
❯ git add foo.txt
❯ git diff --quiet HEADOn git v2.51.0, the output of the last command is empty. On git v2.51.1, the output of the last command is this:
diff --git a/foo.txt b/foo.txt
new file mode 100644
index 0000000..e69de29## Expected behavior
The stated docs for `--quiet`: "Disable all output of the program," so I expect there to be no output, like in older versions.
## Likely cause
I ran a git bisect and isolated this commit:
b55e6d36ebce69136559add8fffd1a65df231518 ( https://github.com/git/git/commit/e1d3d61a45bfdc5031d2066c0e4505ebd8145777 )
"diff: ensure consistent diff behavior with ignore options"