threads / discuss / 64422

git diff: --submodule=diff does not synergise with --name-only

Subject: git diff: --submodule=diff does not synergise with --name-only

## tl;dr

One message between Nov 3, 2025 and Nov 3, 2025.

replies: 0people: 1as markdown or json

Sainan· Nov 3, 2025, 10:51 UTC · lore
Hi, I'm using Git v2.51.2.windows.1 but this bug may have existed as far back as when --submodule=diff was introduced according to my research.
To reproduce this, you need a repository with a submodule which was changed since a given tag, then it can be observed like so:
1. git diff --name-only --submodule=diff <tag> | wc -l
2. git diff --submodule=diff <tag> | grep "diff --git" | wc -l
You should notice a discrepency between the line counts because in the first case only the submodule path is listed, whereas in the second case it correctly recurses into the submodule and lists the files changed in those submodules.
-- Sainan

← back to recent threads