I need a plumbing command to print the commit message of one given commit - nothing more, nothing less.
This will give you a very compact list of all messages for any specified time.
git log --since=1/11/2011 --until=28/11/2011 --no-merges --format=%B > CHANGELOG.TXT
I use shortlog for this:
$ git shortlog master..
Username (3):
Write something
Add something
Bump to 1.3.8
git show
is more a plumbing command than git log
, and has the same formatting options:
git show -s --format=%B SHA1
I started to use
git show-branch --no-name <hash>
It seems to be faster than
git show -s --format=%s <hash>
Both give the same result
It's not "plumbing", but it'll do exactly what you want:
$ git log --format=%B -n 1 <commit>
If you absolutely need a "plumbing" command (not sure why that's a requirement), you can use rev-list
:
$ git rev-list --format=%B --max-count=1 <commit>
Although rev-list
will also print out the commit sha (on the first line) in addition to the commit message.
Not plumbing, but I have these in my .gitconfig:
lsum = log -n 1 --pretty=format:'%s'
lmsg = log -n 1 --pretty=format:'%s%n%n%b'
That's "last summary" and "last message". You can provide a commit to get the summary or message of that commit. (I'm using 1.7.0.5 so don't have %B.)