我刚刚克隆了Keras存储库,并且有兴趣查看git日志。我最初尝试使用漂亮的格式,并在最后4次提交中得到了这个:
me@ARL--M6800:~/Downloads/keras$ git log --pretty=format:"%cn %cd %h"
François Chollet Tue Jan 17 13:29:21 2017 -0800 55487f3
François Chollet Mon Jan 16 17:14:16 2017 -0800 1c6db08
François Chollet Mon Jan 16 10:05:35 2017 -0800 e54d795
François Chollet Sat Jan 14 21:33:04 2017 -0800 82ca6d4
然而,当我没有格式化输出时,我得到了最后4次提交的这些结果:
commit 55487f33b135849cdda49bcc75778976d94a2575
Author: Javier Dehesa <javidcf@gmail.com>
Date: Tue Jan 17 21:29:21 2017 +0000
...
commit 1c6db0815853f7c5421b8057e9167f19b5b94812
Author: Petr Baudis <pasky@ucw.cz>
Date: Tue Jan 17 02:14:16 2017 +0100
...
commit e54d7951f2a82629c71c77ca842ba032b523fe84
Author: Pat York <pat.york@nevada.unr.edu>
Date: Mon Jan 16 10:05:35 2017 -0800
...
commit 82ca6d418588ccd61d663ec8029937290b62d583
Author: Mohanson <mohanson@outlook.com>
Date: Sun Jan 15 13:33:04 2017 +0800
虽然哈希值匹配,但作者和提交日期却没有。有谁知道这是为什么以及它意味着什么?
答案 0 :(得分:1)
似乎File file = new File("../../../test/resources/files/x.pdf");
在一个时区(%cd
)中显示提交者日期,而默认格式在其本地时区中显示日期。这至少在一定程度上与时区差异相符。
关于作者我不知道......
答案 1 :(得分:1)
你应该使用
git log --pretty=format:"%an %ad %h"
as%cn为您提供提交者名称,%为作者姓名(显示在&#34;普通&#34;日志中)
从联系手册:
· %an: author name
· %aN: author name (respecting .mailmap, see git-shortlog(1) or git-blame(1))
· %ae: author email
· %aE: author email (respecting .mailmap, see git-shortlog(1) or git-blame(1))
· %ad: author date (format respects --date= option)
VS
· %cn: committer name
· %cN: committer name (respecting .mailmap, see git-shortlog(1) or git-blame(1))
· %ce: committer email
· %cE: committer email (respecting .mailmap, see git-shortlog(1) or git-blame(1))
· %cd: committer date (format respects --date= option)
· %cD: committer date, RFC2822 style