Kristian
Kristian

Reputation: 1737

Set pretty format for git log only

I find the default pretty format to verbose, so I have made i more concise version with:

[format]
    pretty = %C(yellow)commit:   %h%Creset%C(auto)%d%C(reset)%nauthor:   %an <%ae>%ndate:     %ad%nsummary:  %s%n

which produces something like:

commit:   ab6cdf4 (HEAD -> master, tag: v1.1)
author:   author name <[email protected]>
date:     Fri Nov 15 22:00:00 2019 +0100
summary:  A very nice commit title

with the first line coloured a lot like usual.

However, this does not only affect git log but also git show, and for git show I would actually rather use the medium or fuller formats.

Is there any way of setting the format for git log only? Maybe through another option than format.pretty.

An obvious solution is to make an alias for a version of log or show using the other format, but I would rather avoid that, if possible.

Upvotes: 2

Views: 146

Answers (1)

VonC
VonC

Reputation: 1328152

Considering git config format.pretty is always for git log (configuration) and git show, I have always defined an alias for git log.

For instance:

So an alias in this case might still be the current recommended workaround.

Upvotes: 1

Related Questions