Two questions:
- How to show the first 10 commit in git from beginning to end. (no branch)
- How the specify the commit index and log it. (show the second or third)
I know that git use parent to link the commit, it's easy to log the commit from end to start.
like: git log HEAD~10
But i need to query from the start to end, is it possible?
i would use below simple syntax command;
Simply log everything reverse -1 means list one log
the best result comes with combination of both best answers:
In case someone wants more than just git one-line log:
where the
11
at the end should be set to1
more than the number of commits you want.As here points out
git log --reverse -n 10
doesn't work as you need it to. (I suppose it would need to be non-commutative to give you the ability to chose the first 10 commits in reverse order or the last 10 commitsSimply log everything with one line format and tail the output:
Would show 10 latest commits matching the revision spec (a missing spec means "all commits").
See manpage:
section
Commit Limiting