What does the --- /dev/null
signify in by git show commit
output?
This is an addition of a new file, so I assume it's saying that nothing was removed, but why the reference to /dev/null
?
$ git show a395a
commit a395a7bb4abcc606022ac14a07794b2d3c18bd5b
Author: David Banks <[email protected]>
Date: Sun Apr 12 17:41:08 2015 +0100
My first commit.
diff --git a/test.txt b/test.txt
new file mode 100644
index 0000000..e965047
--- /dev/null
+++ b/test.txt
@@ -0,0 +1 @@
+Hello
It means that because test.txt is a new file, in the diff shown, it was compared to "nothing"; the "file" /dev/null.
You can find that convention (diff against "no file") from the very beginning of Git itself.
The goal was to be more like the cg-patch
Linux tool, which apply a patch from a file, input, or a commit.
See commit 2f97813, Git 0.99, Apr. 2005:
Make
diff-cache
and friends output morecg-patch
friendly.This changes the way the default arguments to diff are built when diff-cache and friends are invoked with
-p
and there is noGIT_EXTERNAL_DIFF
environment variable.
It attempts to be morecg-patch
friendly by:
- Showing diffs against
/dev/null
to denote added or removed files;- Showing file modes for existing files as a comment after the diff label.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With