Kowalchick
Kowalchick

Reputation: 448

GIT Log show only recent entries

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.

Upvotes: 12

Views: 8015

Answers (2)

Aditya
Aditya

Reputation: 1723

The following command will display the last 10 commits:

git log -n 10 --pretty=short

Upvotes: 6

yorammi
yorammi

Reputation: 6458

Run:

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

For all options, see:

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

Upvotes: 25

Related Questions