git log with additional details from body of the commit message
I have a git commit template as below:
[overtype with subject line up to 50 chars ----->]
[overtype with details of what's in the commit]
[other information]
Ticket-Refs:
I would lik开发者_开发问答e to append the string after "Ticket-Refs:" to a git log graph --pretty=format:
I was trying to use the --grep=
to achieve this on the %b
or %B
, any help would be appreciated.
Definitely not the most graceful way, but here is an option:
$ git log --graph --grep=Ticket-Refs --pretty=format:'DELIMITER_STRING%B' | grep '\*.*DELIMITER_STRING\|Ticket' | sed s/DELIMITER_STRING.*//
Or another option
$ git log --graph --grep=Ticket-Refs --pretty=format:'DELIMITER_STRING%b' | grep '\*.*DELIMITER_STRING\|Ticket-Refs' | sed ':a;N;$!ba;s/DELIMITER_STRING.*Ticket-Refs://'
I shamelessly stole some of the code for the second option from another post
I know I am not giving an exact answer, but if you can move the ticket-refs part to git notes
, that is add notes to the commits using something like below:
git notes add sha -m "Ticket-refs:blah"
then you can easily do the graph log like you want:
git log --graph --format="%N"
Otherwise, I am not sure if it is possible to extract that part alone and then use it with the graph.
精彩评论