Two questions:
To get the last 10 commits:
git log HEAD~10..HEAD
To get them in oldest-to-newest order:
git log --reverse HEAD~10..HEAD
Note that if there are merges, this may show more than 10 commits; add --first-parent
if you only want to traverse through the first parent of each branch.
For far more detail, see the documentation for git rev-list
.
git log --no-walk `git rev-list HEAD | tail -n 10`
and:
git log --no-walk `git rev-list --reverse HEAD | head -n 10`
depending on which order you want the results.