git log 常用选项

Posted 认真生活、快乐工作 - 马云

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git log 常用选项相关的知识,希望对你有一定的参考价值。

git log 常用选项

-p 按补丁格式显示每个更新之间的差异

[email protected]:/home/wwwroot/default/5hao/sheep$ git log -p
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

diff --git a/Wx/Tpl/Mine/bean_transfer_step_two.html b/Wx/Tpl/Mine/bean_transfer_step_two.html
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

diff --git a/Wx/Tpl/Mine/bean_transfer_step_two.html b/Wx/Tpl/Mine/bean_transfer
_step_two.html
index 2e56015..204a525 100644
--- a/Wx/Tpl/Mine/bean_transfer_step_two.html
+++ b/Wx/Tpl/Mine/bean_transfer_step_two.html
@@ -1,7 +1,6 @@
 <include file="Public:header" />
 <div class="content">
         <div class="user-info" id="for_data_ejs">
-
         </div>
         <div class="box-form">
             <input type="number" class="bean_transfer_num" placeholder="请输入
转赠五号豆数量" id="bean_transfer_num" onkeyup="value=value.replace(/[^\d]/g,'')" value="" />

--stat 显示每次更新的文件修改统计信息

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --stat
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

 Wx/Tpl/Mine/bean_transfer_step_two.html | 1 -
 1 file changed, 1 deletion(-)

--shortstat 只显示 --stat 中最后的行数修改添加移除统计。

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --shortstat
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

 1 file changed, 1 deletion(-)

--name-only 仅在提交信息后显示已修改的文件清单。

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --name-only
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

Wx/Tpl/Mine/bean_transfer_step_two.html

--name-status 显示新增、修改、删除的文件清单。

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --name-status
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

M       Wx/Tpl/Mine/bean_transfer_step_two.html

--abbrev-commit 仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --abbrev-commit
commit ba6e651
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

--author jiqing 指定作者

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --author jiqing
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <[email protected]>
Date:   Wed Apr 25 16:59:11 2018 +0800

    Merge branch '5hao' of https://git.coding.net/sucry-integral/sheep into 5hao

--pretty 美化

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --pretty=short
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <[email protected]>

    Merge branch '5hao' of https://git.coding.net/sucry-integral/sheep into 5hao

也可以组合使用

[email protected]:/home/wwwroot/default/5hao/sheep$ git log --pretty=short --author=jiqing
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <[email protected]>

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <[email protected]>

    Merge branch '5hao' of https://git.coding.net/sucry-integral/sheep into 5hao

commit 28c658de7b324772c385be232abf48b4b8410cef
Author: jiqing <[email protected]>

    转赠五号豆收尾

commit 0e125b52d1178869274de81943fd16f67d574d06
Author: jiqing <[email protected]>

    转赠五号豆初步

commit 5f80991fe38b1cb44079441eb90e8b629d89d19f
Author: jiqing <[email protected]>

    验证第一步

以上是关于git log 常用选项的主要内容,如果未能解决你的问题,请参考以下文章

前端开发常用js代码片段

前端开发常用代码片段(中篇)

常用python日期日志获取内容循环的代码片段

在选项卡布局的片段内访问自动完成

前端开发中最常用的JS代码片段

vs code 自定义代码片段