Doing a regular git log shows all the log messages until the terminal buffer is full. Sometimes thats not enough, but other times its just too much. What if you only wanted to see the last 5 commit messages, or the last ‘n’ commit messages. Here’s a simple command that lets you do that.
git log --oneline -5
You dont have to use the –oneline option if you want to see more metadata for the commit. 5 represents the size of the list returned by the git log command. Replace it with any number that you wish.