git - `git show` 本身做了什么?

标签 git git-show

如果我在 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/

相关文章:

git - 在 Pycharm 中看不到推送的提交

git - Git如何选择重新设定基准的起点?

php - 如何使用 composer 在团队中开发 PHP 包?

git - 为 git-log 和 git-show 进行不同的 `pretty` 设置

git - 未出现在任何分支中但在 "git show"中可用的提交发生了什么

Git 显示整个文件的变化

node.js - Git Bash 安装 React-Scripts 时出错 "UNKNOWN: unknown error, scandir ' E :\. ..\node_modules\@babel\.helper-annotate-as-pure.DELETE'"

git - Cloud9 git push -> 致命的 : Authentication failed

git - `git stash show -p stash@{N}` 和 `git show stash@{N}` 之间的区别?

git - 当我使用 git 将单个文件 check out 到不同位置时,如何保留行尾?