Display last git commit comment

447

Often during a commit ($ git -commit -m ""), I wish to read my last comment to remember what progress I have made. Is there an easy way to directly access the last commit message through command-line? (I'm using Windows.)

This question is tagged with git

~ Asked on 2011-09-03 12:06:51

The Best Answer is


831

git show

is the fastest to type, but shows you the diff as well.

git log -1

is fast and simple.

git log -1 --pretty=%B

if you need just the commit message and nothing else.

~ Answered on 2011-09-03 12:09:58


96

Generally:

git log -n

will show you the last n commit messages

More elegantly - if you want a quick overview of your commits

git log --oneline -n

This will Show just the first line of the last n commit messages.

You can save this as a git alias or a shell alias with a shorter command. I've got it in my shell as glog, for example, and I can see my last 10 commit messages with glog -10.

~ Answered on 2011-09-03 12:15:08


Most Viewed Questions: