Git, see a list of comments of my last N commits
Use the --author
and/or --committer
filtering options with git log
, plus the -n
option to limit the number of commits. For example:
git log --author='Salvador Dali' -n 10
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:
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.
git log --format="%h %B" --oneline -n 1
This will get you latest git log comment block with abbreviated commit id.
git log --format="%H %B" -n 1
This will get you latest git log comment block with full commit id.
You can build your own format from : Git Pretty Format
git log --author="My name" -n 5
(see man git-log
for all alternatives)