运维之道 | Git log 命令详解

Git log 命令详解

  • Git log 可以让我们查看提交commit history
[root@localhost villian]# git log
commit 7a690b414f87fbbe746338d247260021a51a43e2
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:49:16 2019 +0800

    home_fourth

commit f9828f5273b60638b9f67f135cd4d4b74f3ddb9f
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:46:55 2019 +0800

    home_third

commit 2afde91ff027301499b77cd940b651dda18d5bae
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:38:07 2019 +0800

    home_next

commit 9e6906339361841d1c8b27a4cca91ddc4dba0b99
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:04:23 2019 +0800

    home_first
  • git log默认会输出commit hash, author, date, commit message

git参数详解:

1、 --oneline

  • 这个命令简化git log的默认的输出,仅仅输出commit hash 前7个字符串和commit message.
[root@localhost villian]# git log --oneline
7a690b4 home_fourth
f9828f5 home_third
2afde91 home_next
9e69063 home_first

2、–stat

  • –stat:是在git log 的基础上输出文件增删改的统计数据(不显示具体修改内容)
[root@localhost villian]# git log --stat
commit 7a690b414f87fbbe746338d247260021a51a43e2
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:49:16 2019 +0800

    home_fourth

 home.txt | 1 +
 1 file changed, 1 insertion(+)

commit f9828f5273b60638b9f67f135cd4d4b74f3ddb9f
Author: root <root@localhost.localdomain>
Date:   Sat Oct 26 16:46:55 2019 +0800

    home_third

 home.txt | 1 

你可能感兴趣的:(Git)