我有一个git仓库,有很多分支很多提交,我想找到最新的10个提交,如何做到这一点,谢谢!
w7t8yxp51#
如果你想要所有分支的提交,你需要--all参数,用-10限制git log为10,并使用--date-order告诉git log根据日期对提交进行排序。
git log -10 --all --date-order
myzjeezk2#
对于所有分支中的最后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
unhi4e5o3#
要查找特定数量的提交,可以使用-n选项:
-n
git log -5 # or git log -n 5 # fetches the last 5 commits
正如@honk指出的那样,-n 5和-5是等价的。查找其他分支上的提交,而不 checkout 其他分支:
-n 5
-5
git log branch_name
所以,如果你在develop分支,并希望得到master(oneline)的最后10次提交,你可以这样做:
git log --oneline master -10
要查看所有分支的提交,有一个--all参数。
--all
git log --all
eivnm1vs4#
试试这个git log --graph &你会得到从最新到旧的提交顺序
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它给出了所有提交和分支拓扑
git log --pretty=oneline --graph
4条答案
按热度按时间w7t8yxp51#
如果你想要所有分支的提交,你需要--all参数,用-10限制git log为10,并使用--date-order告诉git log根据日期对提交进行排序。
myzjeezk2#
对于所有分支中的最后10次提交,您可以执行以下操作:
如需进一步自定义,请参阅此处了解更多信息:http://linux.die.net/man/1/git-log
unhi4e5o3#
要查找特定数量的提交,可以使用
-n
选项:正如@honk指出的那样,
-n 5
和-5
是等价的。查找其他分支上的提交,而不 checkout 其他分支:
所以,如果你在develop分支,并希望得到master(oneline)的最后10次提交,你可以这样做:
要查看所有分支的提交,有一个
--all
参数。eivnm1vs4#
试试这个
git log --graph
&你会得到从最新到旧的提交顺序编辑:
或者您可以用途:
git log --pretty=oneline --graph
它给出了所有提交和分支拓扑