git log
The Ultimate Log Format
Over time, I’ve decided that I like the following log format for most of my work.
EXECUTE:
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
It looks like this:
OUTPUT:
$ git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short * e2a3502 2012-03-06 | Added a comment (HEAD, master) [Jim Weirich] * d46b035 2012-03-06 | Added a default value [Jim Weirich] * fa23feb 2012-03-06 | Using ARGV [Jim Weirich] * 4ac2080 2012-03-06 | First Commit [Jim Weirich]
Let’s look at it in detail:
--pretty="..."
defines the format of the output.%h
is the abbreviated hash of the commit%d
are any decorations on that commit (e.g. branch heads or tags)%ad
is the author date%s
is the comment%an
is the author name--graph
informs git to display the commit tree in an ASCII graph layout--date=short
keeps the date format nice and short
reference:http://gitimmersion.com/lab_10.html