git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Kannan Goundan <kannan@cakoose.com>
Cc: git@vger.kernel.org
Subject: Re: Replicating the default "git log" format with a format string.
Date: Fri, 13 Nov 2015 00:38:00 -0500	[thread overview]
Message-ID: <20151113053800.GE29708@sigill.intra.peff.net> (raw)
In-Reply-To: <loom.20151112T011419-749@post.gmane.org>

On Thu, Nov 12, 2015 at 12:55:53AM +0000, Kannan Goundan wrote:

> 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?

Sadly, no, I don't think it is possible with the current format
specifiers. It would be nice if it was, though.

-Peff

  reply	other threads:[~2015-11-13  5:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  0:55 Replicating the default "git log" format with a format string Kannan Goundan
2015-11-13  5:38 ` Jeff King [this message]
2015-11-13 21:41   ` Jacob Keller
2015-11-13 21:52     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151113053800.GE29708@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=kannan@cakoose.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).