The shortest possible output from git log containing author and date

前端 未结 13 1668
我在风中等你
我在风中等你 2020-12-02 03:12

How can I show a git log output with (at least) this information:

* author
* commit date
* change

I want it compressed to one line per log

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 03:52

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

    did the job. This outputs:

      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
    

    Inspired by stackoverflow question: "git log output like svn ls -v", i found out that I could add the exact params I needed.

    To shorten the date (not showing the time) use --date=short

    In case you were curious what the different options were:
    %h = abbreviated commit hash
    %x09 = tab (character for code 9)
    %an = author name
    %ad = author date (format respects --date= option)
    %s = subject
    From kernel.org/pub/software/scm/git/docs/git-log.html (PRETTY FORMATS section) by comment of Vivek.

提交回复
热议问题