当前位置:   article > 正文

GIT查看与比较历史提交信息之git-show_git show

git show

名称

git-show - 命令用于显示各种类型的对象

概要

git show [<options>] [<object>]
  • 1

概要

显示一个或多个对象(blobs,树,标签和提交)。

  • 对于提交,它显示日志消息和文本差异。 它还以git diff-tree --cc生成的特殊格式呈现合并的提交。

  • 对于标签,它显示标签消息和引用对象。

  • 对于树,它显示的名称(相当于使用git ls-tree--name-only选项)。

  • 对于简单的blobs,它显示了普通的内容。

该命令可以使用适用于git diff命令的选项(如–pretty/–format)来控制如何显示提交引入的更改。

选项

  • <object>
    • 1

    The names of objects to show (defaults to HEAD).

  • --pretty[=<format>]
    --format=<format>
    
    • 1
    • 2

    下面是pretty内建的一些格式

    • oneline
    <hash> <title line>
    
    • 1

    This is designed to be as compact as possible.
    在这里插入图片描述

    • short
    commit <hash>
    Author: <author>
    
    • 1
    • 2
    • medium
    commit <hash>
    Author: <author>
    Date:   <author date>
    <title line>
    <full commit message>
    
    • 1
    • 2
    • 3
    • 4
    • 5

    在这里插入图片描述

    • full
    commit <hash>
    Author: <author>
    Commit: <committer>
    <title line>
    <full commit message>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • fuller
    commit <hash>
    Author:     <author>
    AuthorDate: <author date>
    Commit:     <committer>
    CommitDate: <committer date>
    <title line>
    <full commit message>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

例子

  • git show [commit_id] 查看某次历史提交信息的完整信息
    在这里插入图片描述

  • git show [commit_id]:fileName 查看某次commit中某个文件的内容
    在这里插入图片描述

  • git show HEAD查看HEAD标签当前指向的提交的完整信息

  • git show HEAD:fileName 查看HEAD标签当前指向的提交的文件内容
    在这里插入图片描述

  • git show master 查看master分支最新一次提交的完整信息

  • git show master^或git show master~ 查看master分支最新一次提交的父提交的完整信息

  • git show master^2查看master分支最新一次提交的第二个父提交(也就是父提交的父提交)的完整信息

参考

http://www.hechaku.com/git/git_showmingling.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/986022
推荐阅读
相关标签
  

闽ICP备14008679号