1

I have a git commit message that includes 2 lines of text and a blank line. git log shows the whole message, but git log --oneline shows only the 1st line.

How can git log --oneline to show the entire message (ignore the blank line, and append every other line)?

Full log:

$> git log
commit: d9ce3b...
Author: John Doe <john.doe@example.com>
Date:   Fri Mar 10 11:40:58 2023 -0500

   ticket number is #1234

   add a new css class in the select section.

Oneline variant is missing the last line of the message:

$> git log --oneline
d9ce3b ticket number is #1234

What I would like is:

d9ce3b ticket number is #1234 add a new css class in the select section.
André
  • 1,602
  • 2
  • 12
  • 26
foob.ar
  • 445
  • 2
  • 9
  • 19
  • Does this answer your question? [Show full Git commit message in console](https://stackoverflow.com/questions/8824863/show-full-git-commit-message-in-console) – evolutionxbox Mar 13 '23 at 19:32
  • @evolutionxbox Good tips, but this did not answer my question, specific to the use of `--oneline` with multiline commit messages that include blank lines. – foob.ar Mar 13 '23 at 22:26

1 Answers1

1

As far as I can tell, there's no way to do that directly with git.

You can, however, use awk for this:

git log --oneline | awk '{cmd="echo -n "$1"; git log " $1 " --format=\" %B\" -n 1 | paste -sd \" \" "; system(cmd)}'
Paolo
  • 21,270
  • 6
  • 38
  • 69