Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT Log show only recent entries

Tags:

git

I am trying to utilize cmd prompt to get the last 10 commits with the author, commit hash, and description to utilize in a form. I have been experimenting with git log --pretty=short, however, the output seems to go forever.

I would like to know how to reduce the amount of commits returned to the last 10 commits utilizing the git log command. I plan on extracting the information into a data structure for later use.

like image 632
Mitchell Avatar asked Jun 13 '17 14:06

Mitchell


2 Answers

Run:

git log -n <number-of-commits> --pretty=short

For all options, see:

https://git-scm.com/docs/git-log

like image 145
yorammi Avatar answered Oct 22 '22 06:10

yorammi


The following command will display the last 10 commits:

git log -n 10 --pretty=short
like image 33
Aditya Avatar answered Oct 22 '22 05:10

Aditya