如果我在 git 仓库中单独使用 git show
,它会显示一堆信息,例如提交、差异等。
此页面 ( https://git-scm.com/docs/git-show) 只是说:
显示一个或多个对象(blob、树、标签和提交)。
我假设这是最新的提交。还有一些差异(文档页面中未提及)。
但它到底显示了什么?
这是完整的,相当难以理解的输出......
$ git show
commit <sha1 A> (HEAD -> A)
Merge: <sha1 B> <sha1 C>
Author: Snowcrash <my@email>
Date: Sat Jul 14 14:56:02 2018 -0700
with both files
diff --cc 1
index <sha1 D>,<sha1 E>..<sha1 F>
--- a/1
+++ b/1
@@@ -1,5 -1,6 +1,12 @@@
1
++<<<<<<< HEAD
+A
+B
+C
++=======
+ C
+ D
+ E
+
++>>>>>>> master
diff --cc 2
index 0000000,0000000..<sha1 G>
new file mode 100644
--- /dev/null
+++ b/2
@@@ -1,0 -1,0 +1,1 @@@
++2
最佳答案
git show
等同于 git show HEAD
,即当前分支中的最新提交 ( more info)。
来源:https://github.com/git/git/commit/9f5258cbb8f8ed2bf86b0078f178a26adc572eb9
关于git - `git show` 本身做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51343765/