Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何找到 git 存储库的最后几个提交(比如“20”个提交)。git log 显示所有提交,我只需要最后几个提交。
很多方法,所有方法都记录在git-log手册页中。
git-log
指定一个-n或--max-count:
-n
--max-count
$ git log -n 20
或者,以以下形式指定提交范围<since>..<until>:
<since>..<until>
$ git log HEAD~20..HEAD
你可以省略,<until>因为它是 HEAD:
<until>
$ git log HEAD~20..
而不是使用git log -n 20,简单地gitk --all &可以看到结构和一些详细信息。
git log -n 20
gitk --all &