2

How to find the last few commits (say "20" commits) to a git repository. git log shows all the commits, I just need the last few commits.

2 Answers 2

5

Lots of ways, all of them documented in the git-log man page.

Specify a -n or --max-count:

$ git log -n 20 

Or, specify a range of commits in the form of <since>..<until>:

$ git log HEAD~20..HEAD 

You can omit the <until> since it's HEAD:

$ git log HEAD~20.. 
Sign up to request clarification or add additional context in comments.

Comments

-1

instead of using git log -n 20, simply gitk --all & can see the structs and some detailed information.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.