我有一个git存储库,有许多分支很多提交,我想找到最新的10个提交,如何做到这一点,谢谢!
答案 0 :(得分:30)
如果你想要所有分支的提交,你需要--all参数,使用-10将git log限制为10并使用--date-order告诉git log对日期的提交进行排序。
git log -10 --all --date-order
答案 1 :(得分:6)
对于所有分支机构的最后10次提交,您可以这样做:
git log --graph --all --format=format:'%h - (%ai) %s — %cn %d' --abbrev-commit --date=relative -10
如果您需要进一步定制,请参阅此处了解更多信息: http://linux.die.net/man/1/git-log
答案 2 :(得分:4)
要查找特定数量的提交,您可以使用-n
选项:
git log -5 # or git log -n 5 # fetches the last 5 commits
正如@honk指出的那样,-n 5
和-5
是等价的。
要查找其他分支上的提交,而不检查其他分支:
git log branch_name
所以,如果你在开发分支并希望得到最后10个master(oneline)的提交,你可以这样做:
git log --oneline master -10
要查看所有分支的提交,有一个--all
参数。
git log --all
答案 3 :(得分:1)
试试这个git log --graph
&您将获得最新订单中的提交以及
•the checksum of the commit
•the author name and email
•the date the author committed it
•the full commit message
修改强>
或者您可以使用:
git log --pretty=oneline --graph
给出所有提交和&分支拓扑