Git, see a list of comments of my last N commits

Salvador Dali picture Salvador Dali · Nov 24, 2012 · Viewed 67.3k times · Source

Is there a way to see a list of comments and time of my last N commits in Git?

After looking on SO, the only relevant thing I have found is Git - get all commits and blobs they created, but it shows all commits from all users, and outputs a lot of other information.

Answer

Abizern picture Abizern · Nov 24, 2012

If you want to use the command line you can use the --author=<your name>

For example: to see your last 5 commits

git log -n 5 --author=Salvador

If you want a simpler one line solution:

git log --oneline -n 5 --author=Salvador

Edited to add

If you like the single line version, try creating an alias for git log like this (this is what I have for zsh)

alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Now, I can just use:

glog -n 5

And I get a nice output such as:

Terminal output

Which is colourised, shows the name of the author and also shows the graph and you can still pass in other flags (such as --author) which lets you filter it even more.