小编典典

包含作者和日期的 git log 的最短输出

all

如何使用(至少)以下信息显示 git log 输出:

* author
* commit date
* change

我希望它压缩到每个日志条目一行。最短的格式是什么?

(试过--format=oneline但没有显示日期)


阅读 117

收藏
2022-03-06

共1个答案

小编典典

git log --pretty=format:"%h%x09%an%x09%ad%x09%s"

做了这项工作。这输出:

  fbc3503 mads    Thu Dec 4 07:43:27 2008 +0000   show mobile if phone is null...   
  ec36490 jesper  Wed Nov 26 05:41:37 2008 +0000  Cleanup after [942]: Using timezon
  ae62afd tobias  Tue Nov 25 21:42:55 2008 +0000  Fixed #67 by adding time zone supp
  164be7e mads    Tue Nov 25 19:56:43 2008 +0000  fixed tests, and a 'unending appoi
  93f1526 jesper  Tue Nov 25 09:45:56 2008 +0000  adding time.ZONE.now as time zone 
  2f0f8c1 tobias  Tue Nov 25 03:07:02 2008 +0000  Timezone configured in environment
  a33c1dc jesper  Tue Nov 25 01:26:18 2008 +0000  updated to most recent will_pagina

受问题的启发:“git log output like svn ls-v”](https://codingdict.com/questions/225499),我发现我可以添加我需要的确切参数。

要缩短日期(不显示时间),请使用--date=short

如果您好奇不同的选项是什么:

%h = abbreviated commit hash
%x09 = tab (character for code 9)
%an = author name
%ad = author date (format respects –date= option)
%s = subject

2022-03-06