Git查看提交历史
2019-12-18 本文已影响0人
走过分叉路
不带参数的log命令
$ git log
commit ca82a6dff817ec66f44342007202690a93763949 (HEAD -> master, origin/master, origin/HEAD)
Author: Scott Chacon <schacon@gmail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the verison number
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <schacon@gmail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test code
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <schacon@gmail.com>
Date: Sat Mar 15 10:31:28 2008 -0700
first commit
git log --prety=format常用的选项
image.png示例:显示作者的电子邮件地址,提交者的名字, 提交说明
$ git log --pretty=format:"%ae, %cn, %s"
schacon@gmail.com, Scott Chacon, changed the verison number
schacon@gmail.com, Scott Chacon, removed unnecessary test code
schacon@gmail.com, Scott Chacon, first commit
git log的常用选项
image.png示例:显示新增、修改、删除的文件清单
$ git log --name-status
commit ca82a6dff817ec66f44342007202690a93763949 (HEAD -> master, origin/master, origin/HEAD)
Author: Scott Chacon <schacon@gmail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the verison number
M Rakefile
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <schacon@gmail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test code
M lib/simplegit.rb
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <schacon@gmail.com>
Date: Sat Mar 15 10:31:28 2008 -0700
first commit
A README
A Rakefile
A lib/simplegit.rb
git log限制输出长度
限制git log输出的选项 image.png示例:提交对象的简短的哈希字符串 - 提交说明,过滤时间是2006-10-01到2018-11-01期间,提交但未合并的记录
$ git log --pretty="%h - %s" --since="2006-10-01" --before="2018-11-01" --no-merges -- t/