簡體   English   中英

如何在一個git存儲庫中找到最新的提交?

[英]How to find the latest commits in one git repository?

我有一個git存儲庫,有很多分支很多提交,我想找到最新的10個提交,如何做到這一點,謝謝!

如果你想要所有分支的提交,你需要--all參數,使用-10將git log限制為10並使用--date-order告訴git log對日期的提交進行排序。

git log -10 --all --date-order

對於所有分支機構的最后10次提交,您可以:

git log --graph --all --format=format:'%h - (%ai) %s — %cn %d' --abbrev-commit --date=relative -10
  • %h是提交哈希
  • %ai是作者日期(使用%ci作為提交者日期)
  • %s是提交主題
  • %cn是提交者名稱
  • -10表示最后10次提交

如果您需要進一步定制,請參閱此處了解更多信息: http//linux.die.net/man/1/git-log

要查找特定數量的提交,可以使用-n選項:

git log -5  # or git log -n 5 # fetches the last 5 commits

正如@honk指出的那樣, -n 5-5是等價的。

要查找其他分支上的提交,而不檢查其他分支:

git log branch_name

所以,如果你在開發分支並且希望得到master(oneline)的最后10個提交,你可以這樣做:

git log --oneline master  -10

要查看所有分支的提交,可以使用--all參數。

git log --all

試試這個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

它提供了所有提交和分支拓撲

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM