Two questions:
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?
The most basic filtering option for git log is to limit the number of commits that are displayed. When you're only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log 's output by including the - option.
By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first. As you can see, this command lists each commit with its SHA-1 checksum, the author's name and email, the date written, and the commit message.
Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA) author. date.
git log -10
Would show 10 latest commits matching the revision spec (a missing spec means "all commits").
See manpage:
git help log
section Commit Limiting
-<number>, -n <number>, --max-count=<number>
Limit the number of commits to output.
Simply log everything with one line format and tail the output:
git log --pretty=oneline | tail -n 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With