gitformattinglogging

The shortest possible output from Git log, containing author and date


How can I show a Git log output with (at least) the following information?

I want it compressed to one line per log entry. What's the shortest possible format for that?

(I tried --format=oneline, but that does not show the date.)


Solution

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

    does 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
    

    It was inspired by Stack Overflow question: "Git log output like 'svn ls -v'". I found out that I could add the exact parameters I needed.

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

    In case you were curious what the different options were:

    It is from git-log(1) Manual Page (PRETTY FORMATS section) by the comment of Vivek.