Minimum output of git log with author and date

How to display (at least) git log output of this information:

* author
* commit date
* change

I want each log entry to be compressed to one row. What is the shortest format?

(tried -- format=oneline but did not show date)

#1 building

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

Use -- date = to format the date

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

#2 building

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

Did the work. This output:

  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

suffer Stack overflow problem Inspire : "git log output looks like svn ls -v" , I found that I can add the exact parameters I need.

To shorten the date (time is not shown), use -- date=short

In case you are curious about the different options:
%h = abbreviated commit hash
%x09 = tab (character of code 9)
%an = author's name
%ad = author date (format respect - date = option)
%s = theme
Come from kernel.org/pub/software/scm/git/docs/git-log.html(PRETTY Format section) comment on Vivek.

#3 building

To show that I'm ready to push submissions, I did

git log remotes/trunk~4..HEAD --pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s" --date=short | awk -F'\t' '{gsub(/[, ]/,"",$2);gsub(/HEAD/, "\033[1;36mH\033[00m",$2);gsub(/master/, "\033[1;32mm\033[00m",$2);gsub(/trunk/, "\033[1;31mt\033[00m",$2);print $1 "\t" gensub(/([\(\)])/, "\033[0;33m\\1\033[00m","g",$2) $3}' | less -eiFRXS

The output looks like:

ef87da7 2013-01-17 haslers      (Hm)Fix NPE in Frobble
8f6d80f 2013-01-17 haslers      Refactor Frobble
815813b 2013-01-17 haslers      (t)Add Wibble to Frobble
3616373 2013-01-17 haslers      Add Foo to Frobble
3b5ccf0 2013-01-17 haslers      Add Bar to Frobble
a1db9ef 2013-01-17 haslers      Add Frobble Widget

The first column is yellow, while the 'H''m' and 't' in parentesis show the HEAD, master, and trunk in their usual "- decorate" colors

There's a line break here, so you can see what it's doing:

git log remotes/trunk~4..HEAD --date=short
    --pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s"
    | awk -F'\t' '{
         gsub(/[, ]/,"",$2);
         gsub(/HEAD/, "\033[1;36mH\033[00m",$2);
         gsub(/master/, "\033[1;32mm\033[00m",$2);
         gsub(/trunk/, "\033[1;31mt\033[00m",$2);
         print $1 "\t" gensub(/([\(\)])/, "\033[0;33m\\1\033[00m","g",$2) $3}'

I have the nickname "stage":

git config alias.staged '!git log remotes/trunk~4..HEAD --date=short --pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s" | awk -F"\t" "{gsub(/[, ]/,\"\",\$2);gsub(/HEAD/, \"\033[1;36mH\033[00m\",\$2);gsub(/master/, \"\033[1;32mm\033[00m\",\$2);gsub(/trunk/, \"\033[1;31mt\033[00m\",\$2);print \$1 \"\t\" gensub(/([\(\)])/, \"\033[0;33m\\\\\1\033[00m\",\"g\",\$2) \$3}"'

Is there an easier way to escape this? It's a bit tricky to find out what needs to be avoided.)

#4 building

All of the above suggestions use the% s placeholder as a theme. I recommend% B because of the% s format Keep the new line , the multiline commit message is displayed as squashed.

git log --pretty=format:"%h%x09%an%x09%ai%x09%B"

#5 building

Use predefined git aliases, that is:

$ git work

Create once per command:

$ git config --global alias.work 'log --pretty=format:"%h%x09%an%x09%ad%x09%s"'

https://git-scm.com/book/tr/v2/Git-Basics-Git-Aliases

Or use more colors in the chart:

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

Keywords: git Mobile svn less

Added by GrizzlyBear on Sat, 08 Feb 2020 19:01:11 +0200