Use git log to see the last ‘n’ commit messages

Doing a reg­u­lar git log shows all the log mes­sages until the ter­mi­nal buffer is full. Some­times thats not enough, but other times its just too much. What if you only wanted to see the last 5 com­mit mes­sages, or the last ‘n’ com­mit mes­sages. Here’s a sim­ple com­mand that lets you do that.

git log --oneline -5

You dont have to use the –one­line option if you want to see more meta­data for the com­mit. 5 rep­re­sents the size of the list returned by the git log com­mand. Replace it with any num­ber that you wish.

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *