当前位置:   article > 正文

git blame_git blame参数

git blame参数

         git blame 显示该文件的修改,以及作者上次修改文件的内容。不会告诉你文件中被删除以及替换的内容,要详细的知道还需要配合git diff的使用。
首先我一个test git库中创建了aa文件,并进行了三次commiit,和只属于工作目录的修改。我来使用git blame看一下。
$git blame aa
^2cae297 (camille          2013-06-02 17:56:14 +0800  1) The beginning is to learn git blame
^2cae297 (camille          2013-06-02 17:56:14 +0800  2) the second to add some difference.
^2cae297 (camille          2013-06-02 17:56:14 +0800  3) ok, let's go ,you can do it !
aba91773 (camille          2013-06-02 17:58:26 +0800  4)
aba91773 (camille          2013-06-02 17:58:26 +0800  5)
aba91773 (camille          2013-06-02 17:58:26 +0800  6)
aba91773 (camille          2013-06-02 17:58:26 +0800  7) After first commit ,I want to add some charater to test git blame
9db59f5a (camille          2013-06-02 18:09:21 +0800  8)
9db59f5a (camille          2013-06-02 18:09:21 +0800  9)
9db59f5a (camille          2013-06-02 18:09:21 +0800 10)
9db59f5a (camille          2013-06-02 18:09:21 +0800 11) This is the third commit ,for testing -b option
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 12)
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 13)
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 14) this is the change of work directory.
使用--show-stats参数显示改动外,在最后还会输出你当前git work的统计数据。
$git blame --show-stats aa   
^2cae297 (camille          2013-06-02 17:56:14 +0800  1) The beginning is to learn git blame
^2cae297 (camille          2013-06-02 17:56:14 +0800  2) the second to add some difference.
^2cae297 (camille          2013-06-02 17:56:14 +0800  3) ok, let's go ,you can do it !
aba91773 (camille          2013-06-02 17:58:26 +0800  4)
aba91773 (camille          2013-06-02 17:58:26 +0800  5)
aba91773 (camille          2013-06-02 17:58:26 +0800  6)
aba91773 (camille          2013-06-02 17:58:26 +0800  7) After first commit ,I want to add some charater to test git blame
9db59f5a (camille          2013-06-02 18:09:21 +0800  8)
9db59f5a (camille          2013-06-02 18:09:21 +0800  9)
9db59f5a (camille          2013-06-02 18:09:21 +0800 10)
9db59f5a (camille          2013-06-02 18:09:21 +0800 11) This is the third commit ,for testing -b option
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 12)
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 13)
00000000 (Not Committed Yet 2013-06-02 18:25:21 +0800 14) this is the change of work directory.
num read blob: 6
num get patch: 3
num commits: 3
-f/--show-name  参数会显示出文件的原始名称 -n/--show-number 显示文件的行数
$git blame -f -n aa
^2cae297 aa  1 (camille          2013-06-02 17:56:14 +0800  1) The beginning is to learn git blame
^2cae297 aa  2 (camille          2013-06-02 17:56:14 +0800  2) the second to add some difference.
^2cae297 aa  3 (camille          2013-06-02 17:56:14 +0800  3) ok, let's go ,you can do it !
aba91773 aa  4 (camille          2013-06-02 17:58:26 +0800  4)
aba91773 aa  5 (camille          2013-06-02 17:58:26 +0800  5)
aba91773 aa  6 (camille          2013-06-02 17:58:26 +0800  6)
aba91773 aa  7 (camille          2013-06-02 17:58:26 +0800  7) After first commit ,I want to add some charater to test git blame
9db59f5a aa  8 (camille          2013-06-02 18:09:21 +0800  8)
9db59f5a aa  9 (camille          2013-06-02 18:09:21 +0800  9)
9db59f5a aa 10 (camille          2013-06-02 18:09:21 +0800 10)
9db59f5a aa 11 (camille          2013-06-02 18:09:21 +0800 11) This is the third commit ,for testing -b option
00000000 aa 12 (Not Committed Yet 2013-06-02 18:40:38 +0800 12)
00000000 aa 13 (Not Committed Yet 2013-06-02 18:40:38 +0800 13)
00000000 aa 14 (Not Committed Yet 2013-06-02 18:40:38 +0800 14) this is the change of work directory.
-p/--porcelain 该参数让输出以系统消耗的形式体现。
$git blame -p aa
author camille
author-mail <camille8707@163.com>
author-time 1370166974
author-tz +0800
committer camille
committer-mail <camille8707@163.com>
committer-time 1370166974
committer-tz +0800
summary add the firse file aa
boundary
filename aa
        The beginning is to learn git blame
2cae29731f13611e7ddba68ae444f37d45b8b979 2 2
        the second to add some difference.
2cae29731f13611e7ddba68ae444f37d45b8b979 3 3
        ok, let's go ,you can do it !
aba917735c7034255d6f340bd0ad384b1c7365ab 4 4 4
author camille
author-mail <camille8707@163.com>
author-time 1370167106
author-tz +0800
committer camille
committer-mail <camille8707@163.com>
committer-time 1370167106
committer-tz +0800
summary the second commit
previous 2cae29731f13611e7ddba68ae444f37d45b8b979 aa
filename aa
-t 参数可以让时间以时间戳的形式显示:2013-06-02 18:09:21  ------〉1370167761
-l 参数可以令其显示长串的哈希码   :aba9177   -----〉aba917735c7034255d6f340bd0ad384b1c7365ab
-s 参数可以简化输出,不显示作者及时间戳
-e 参数输出user.email 替换 user.name 
-w 参数可以忽略空行的不同。
-L  n ,m 参数可以查看制定n 到 m行的修改内容
-C ,-M ,-S,--contents 没有用明白,未完待续~


边界提交指的是git 仓库中的第一次提交。


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

闽ICP备14008679号