Since v2.28.0-2-g296d4a94e7 (diff: add -I<regex> that ignores matching changes) diff -I<regex> can be used to suppress hunks of only matching lines. This interacts in a surprising way with --name-only, which lists all changed files, regardless of whether they are filtered out by -I<regex>: git diff HEAD~ -I '' # always empty git diff HEAD~ -I '' --name-only # not empty, "-I" does nothing It could be nice to only show names of files with matching hunks (or reject this combination of options?).