Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different pretty formats for git log and git show?

Tags:

git

git-log

I have this in my .gitconfig:

[format]
    pretty = %C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)

This makes the output of git log look like this (plus some nice colors):

6b1d043 (origin/master) - Ismail Badawi : Don't redirect to index after saving query. (28 hours ago)
df98a3e - Ismail Badawi : Store example queries in database & cache results (30 hours ago)
6de44ab - Ismail Badawi : Add sanity check tests for different pages. (31 hours ago)
7b6b46b - Ismail Badawi : Save query results for saved queries. (31 hours ago)

I find this format easy to scan through. I don't like that it also affects git show though; in particular, I'd like to be able to see the full commit message in the output of git show, not just the title line; also the actual date instead of relative, the author email, etc.

Is there some way to use different default formats for git log and git show?

like image 315
Ismail Badawi Avatar asked Oct 20 '22 18:10

Ismail Badawi


1 Answers

Both git log and show use the same configuration.

--format=<format>
    Pretty-print the contents
    ...
    Note: you can specify the default pretty format in the repository configuration (see git-config(1)).

https://www.kernel.org/pub/software/scm/git/docs/git-show.html

However, why don't you just define an alias to one of them and use that instead? For example, you could have git alias.vshow 'show --pretty=<your other format string>'.

like image 136
mockinterface Avatar answered Oct 24 '22 09:10

mockinterface