我如何用(至少)这些信息显示git日志输出:

* author
* commit date
* change

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

(try——format=oneline,但不显示日期)


当前回答

如果你想指定一个文件或文件夹,只需在最后添加路径:

%ad =作者日期(格式尊重——date=option) ——date=raw显示从epoch (1970-01-01 00:00:00 UTC)开始的秒数,后面是一个空格,然后是时区,作为UTC Reference的偏移量

git log -1 --pretty=format:"%ad" --date=raw path/to/your/folder

其他回答

git --no-pager log --pretty=tformat:"%C(yellow)%h %C(cyan)%ad %Cblue%an%C(auto)%d %Creset%s" --graph --date=format:"%Y-%m-%d %H:%M" -25 

我使用别名

alias gitlog='git --no-pager log --pretty=tformat:"%C(yellow)%h %C(cyan)%ad %Cblue%an%C(auto)%d %Creset%s" --graph --date=format:"%Y-%m-%d %H:%M" -25'

区别:我使用tformat和isodate,不带秒和时区,使用——no-page你会看到颜色

在项目文件夹中运行:

$ git log --pretty=format:"%C(yellow)%h %ar %C(auto)%d %Creset %s , %Cblue%cn" --graph --all

如果你愿意,添加这一行到你的~/.gitconfig:

[alias]
    ...
    list = log --pretty=format:\"%C(yellow)%h %ar %C(auto)%d %Creset %s, %Cblue%cn\" --graph --all
git log --pretty=format:"%H %an %ad"

使用——date=设置日期格式

git log --pretty=format:"%H %an %ad" --date=short

试试git log——pretty=fuller,它会告诉你:- 作者: 作者日期: 提交: 提交日期:

希望这能有所帮助。

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
                                                                              

受到stackoverflow问题的启发:“git log output like svn ls -v”,我发现我可以添加我需要的确切参数。

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

如果你好奇有哪些不同的选择: %h =缩写提交哈希 %x09 = TAB(代码9的字符) %an =作者名 %ad =作者日期(格式尊重——date= option) %s = subject 来自kernel.org/pub/software/scm/git/docs/git-log.html (PRETTY格式部分)由Vivek的评论。