git log 常用选项

git log 常用选项

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

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log -p
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
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 显示每次更新的文件修改统计信息

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --stat
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
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 中最后的行数修改添加移除统计。

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --shortstat
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

 1 file changed, 1 deletion(-)

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

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --name-only
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

Wx/Tpl/Mine/bean_transfer_step_two.html

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

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --name-status
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

M       Wx/Tpl/Mine/bean_transfer_step_two.html

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

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --abbrev-commit
commit ba6e651
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

--author jiqing 指定作者

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --author jiqing
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:28 2018 +0800

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <jiqing@caomall.net>
Date:   Wed Apr 25 16:59:11 2018 +0800

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


--pretty 美化

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --pretty=short
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <jiqing@caomall.net>

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


也可以组合使用

jiqing@Ubuntu:/home/wwwroot/default/5hao/sheep$ git log --pretty=short --author=jiqing
commit ba6e651f722d1c4e3612ab38b132377711edc709
Author: jiqing <jiqing@caomall.net>

    转赠五号豆收尾

commit c1b7ec7ea1f0cf076197c9b105f2e968f5b4d1c8
Merge: 28c658d 0063f8d
Author: jiqing <jiqing@caomall.net>

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

commit 28c658de7b324772c385be232abf48b4b8410cef
Author: jiqing <jiqing@caomall.net>

    转赠五号豆收尾

commit 0e125b52d1178869274de81943fd16f67d574d06
Author: jiqing <jiqing@caomall.net>

    转赠五号豆初步

commit 5f80991fe38b1cb44079441eb90e8b629d89d19f
Author: jiqing <jiqing@caomall.net>

    验证第一步

原文地址:https://www.cnblogs.com/jiqing9006/p/8946052.html