git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Replicating the default "git log" format with a format string.
@ 2015-11-12  0:55 Kannan Goundan
  2015-11-13  5:38 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Kannan Goundan @ 2015-11-12  0:55 UTC (permalink / raw)
  To: git

For our workflow, author dates aren't very useful.  I'm looking for a way to
configure Git so that "git log" shows commit dates instead of author dates.
 "--pretty=fuller" gets me almost what I want, but I'd like to avoid the
extra two lines if possible.

I tried achieving this by putting a custom format string in ~/.gitconfig:

[format]
  pretty = "%C(auto,yellow)commit %C(auto)%H\nAuthor: %an <%ae>\nDate:  
%cd\n\n%w(0,4,4)%B"

This works pretty well, but has a few corner cases.  When you do "git log
--decorate", the default format decorates commits with ref names.  I can add
"%d" to my format string, but then the ref names show up all the time, even
without "--decorate".

The "--walk-reflogs" option presents a similar problem.  The %g*
placeholders all become empty strings when "--walk-reflogs" isn't present,
which is sort of what I want, but it leaves extra blank lines in the output.

Is it possible to exactly replicate the default "git log" format with a
format string?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-13 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12  0:55 Replicating the default "git log" format with a format string Kannan Goundan
2015-11-13  5:38 ` Jeff King
2015-11-13 21:41   ` Jacob Keller
2015-11-13 21:52     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).