You can find this convention (diff versus "no file") from the very beginning of Git itself.
The goal was to look more like a gc-patch Linux tool that uses a patch from a file, input, or commit.
See commit 2f97813 , Git 0.99, April 2005:
Make diff-cache , and friends output more cg-patch .
This changes the way the default arguments for diff are constructed when diff-cache and friends are called with -p and there is no GIT_EXTERNAL_DIFF environment variable.
He is trying to be more friendly cg-patch :
- Display differences with
/dev/null to indicate added or deleted files ; - Display file modes for existing files as comments after the diff label.
source share