Optional indented git log line

I used several aliases gitfor some teams log. I have most of what I would like (a loan here ), but I have problems with one thing. When i call

git log --graph --format=format:'%h - [%ar] %s%+d'

I get

* ab123f - [6 hours ago] Fix the references
|  (HEAD, origin/master, master)
* bc123f - [8 hours ago] New build syntax
* cd123f - [10 hours ago] Initial import

Where %+dadds a new line and puts tags --decorateon it, if they exist. I would like the tags to match the timestamp, for example:

* ab123f - [6 hours ago] Fix the references
|          (HEAD, origin/master, master)
* bc123f - [8 hours ago] New build syntax
* cd123f - [10 hours ago] Initial import

How to do it? I do not want to use a new line if there are no tags --decorate. I have experimented with a variety of fillers format: %+d , %-d, %+ d(which does not work); permutation %>(<N>), %>>(<N>); and so on, but I can’t get him to do what I want.

, , , torek. :

git log --graph --format=format:'%C(bold yellow)%h%C(reset) - %C(green)(%ar)%C(reset) %s %C(white)<%an>%C(reset)%C(auto)%+d%C(reset)'
+4
3

% w, , .

git log --graph --format=format:'%h - [%ar] %-s%w(0,0,9)%+d'

Git 1.8.5.2

+4

... %n%-... , .

! '%h - [%ar] %s%n%-w(80,9)%+d' !

( , , , 9, , % d ), ( %+w %w...%+d %n %-) .

+1

awk - - . , .

git log --format=format:'%h - [%ar%] %s %d' | awk -F'(' '{print $1} {if ( $2 != "" ) print "\t  ("$2}'

, , -, .

0
source

Source: https://habr.com/ru/post/1531852/


All Articles