Print commit message of a given commit in git

Question

I need a plumbing command to print the commit message of one given commit - nothing more, nothing less.

Answer

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.

How to remove file from Git history?

How to delete a stash created with git stash create?