git show
命令用於顯示各種類型的對象。
使用語法
git show [options] <object>…
描述
顯示一個或多個對象(blobs
,樹,標籤和提交)。
對於提交,它顯示日誌消息和文本差異。 它還以git diff-tree --cc
生成的特殊格式呈現合併提交。
對於標籤,它顯示標籤消息和引用對象。
對於樹,它顯示的名稱(相當於使用git ls-tree
和--name-only
選項)。
對於簡單的blobs
,它顯示了普通的內容。
該命令採用適用於git diff-tree
命令的選項來控制如何顯示提交引入的更改。
示例
以下是一些示例 -
1.顯示標籤v1.0.0,以及標籤指向的對象
$ git show v1.0.0
2.顯示標籤v1.0.0指向的樹
$ git show v1.0.0^{tree}
3.顯示標籤v1.0.0指向的提交的主題
$ git show -s --format=%s v1.0.0^{commit}
4.顯示 Documentation/README 檔的內容,它們是 next 分支的第10次最後一次提交的內容
$ git show next~10:Documentation/README
5.將Makefile的內容連接到分支主控的頭部
$ git show master:Makefile master:t/Makefile
上一篇:
git submodule命令
下一篇:
git shortlog命令