我有一个git存储库,有很多分支很多提交,我想找到最新的10个提交,如何做到这一点,谢谢!
如果你想要所有分支的提交,你需要--all参数,使用-10将git log限制为10并使用--date-order告诉git log对日期的提交进行排序。
git log -10 --all --date-order
For last 10 commits in all branches, you can do:
git log --graph --all --format=format:'%h - (%ai) %s — %cn %d' --abbrev-commit --date=relative -10
See here for more info if you need to customize further: http://linux.die.net/man/1/git-log
To find specific number of commits you can use the -n
option :
git log -5 # or git log -n 5 # fetches the last 5 commits
As, @honk pointed out, -n 5
and -5
are equivalent.
To find commits on other branch, without checking out the other branch :
git log branch_name
So, if you are at develop branch and wish to get last 10 commits of master(oneline), you could do:
git log --oneline master -10
To view commits of all branches there's a --all
argument.
git log --all
Try this git log --graph
& you will get the commits in the order latest to old along with
•the checksum of the commit
•the author name and email
•the date the author committed it
•the full commit message
EDIT:
or you can use:
git log --pretty=oneline --graph
which gives all the commits & branch topology
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.