如何配置'git log'以显示'提交日期'
如何配置 git log
来显示 commit date
而不是 author date
?
How can I configure git log
to show commit date
instead of author date
?
有几个选项。可能最简单的方法就是使用预先准备好的 - 漂亮的
格式之一,比如 git log --pretty = fuller
- 这会显示两个日期。如果您只想查看一个日期,但将其作为提交日期,则可以使用 git log --format =< some stuff>
。用于定义格式的所有允许代码均记录在 git help log
。提交日期是%cd
,%cD
,%cr $ c之一$ c>,
%ct
或%ci
,具体取决于您喜欢的格式。
There are several options. Probably the easiest is to just use one of the pre-baked --pretty
formats, like git log --pretty=fuller
- this will show both dates. If you want to see only one date, but make it the commit date, you can use git log --format=<some stuff>
. All the allowable codes for defining the format are documented in git help log
. The commit date is one of %cd
, %cD
, %cr
, %ct
or %ci
, depending on what format you prefer it in.
如果您希望经常执行此操作,请将其放入别名或编写辅助脚本以节省打字时间。
If it's something you want to do often, put it in an alias or write an auxiliary script to save on typing.