Given the following example git commit message:
My commit message summary
Some more body in this message...
Signed-off-by: My name <[email protected]>
Issue: MYPROJ-123
I can now parse these 'trailers' (key/value parameters in the footer) with recent Git versions (2.14+) using git interpret-trailers --parse
.
This appears integrated into git-log formatting options as well, e.g.:
git log --format="%h %s %(trailers)"
However, it shows me all trailers, including the line breaks.
Would it be possible to limit this to the value(s) of a single trailer token? Ideally, what I'd like to accomplish is something like this as a git-log line, showing the value of the Issue
token only:
0123abcd My commit message summary MYPROJ-123
This is possible using trailers options. Following your example the command line would be:
git log --format="%h %s %(trailers:key=Issue,valueonly)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With