Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set maximum field lenghs for git log prettyprint?

Tags:

git

How can I specify maximum field lengths with git log? I want the output columns to be aligned.

like image 632
user2494490 Avatar asked Feb 17 '23 05:02

user2494490


1 Answers

You can specify the column width without using ANY external tool at all:

git log --format="%<(25,trunc)%ad | %<(25,trunc)%s | %<(25,trunc)%an"

There are TONs of other options, e.g.

%<|(25)

to align the output to columns. You can format columns to be left bound, right bound or even centered and so on: https://git-scm.com/docs/pretty-formats

Unfortunately I do not know when this has been added to git, I am using 2.10.1 on Windows…

like image 100
MarkusL Avatar answered Feb 27 '23 09:02

MarkusL