What does the git documentation mean by 'unwrapped subject and body' for %B pretty print specifier

Viewed 338

If you search for %b and %B in the documentation, there is no explanation of the difference between them apart from the cryptic "(unwrapped subject and body)".

Here is an example commit from a repo (using git version 2.9.3) and the differing result printed from using %b vs. %B. The commit command was git commit -m 'Automated version update from Jenkins.'

$ git log -1 origin/master
commit 30ac57e...
Author: Jenkins <email@email.com>
Date:   Wed Jul 12 16:28:41 2017 +0000

    Automated version update from Jenkins.
$ git log -1 --format=%B origin/master
Automated version update from Jenkins.

$ git log -1 --format=%b origin/master

$ 

I do not understand why %b fails to produce the commit message body, nor why %B (if it contains "subject and body" in some sense) only provides the message body.

What is the underlying difference between %b and %B for pretty printing from logs?

If you want to reliably print just the most recent commit message (message only), how should you do so? I thought it should be git log -1 --format=%b origin/master but this example seems to suggest otherwise. Will %B work reliably, or does the phrase "(unwrapped subject and body)" mean it may somehow include the subject in some situations?

3 Answers
Related