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
I did this
git reflog -1 | sed 's/^.*: //'
If you want to see just the subject (first line) of the commit message:
git log -1 --format=%s
This was not previously documented in any answer. Alternatively, the approach by nos also shows it.
Reference:
To start with git log -1 --pretty='%s'
But the below one covers all the cases,
git log --pretty='format:%Creset%s' --no-merges -1
Paste & see for yourself
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.