是否有办法从给定的提交号获取提交列表到HEAD?

我知道这是可能的提交日期,但我需要它的提交号,我似乎找不到任何文档,甚至这是可能的。


当前回答

git log <hash>..

是最少的打字量。省略“HEAD”假设这就是你的意思。Rev-list也可以。

其他回答

git log <hash>..

是最少的打字量。省略“HEAD”假设这就是你的意思。Rev-list也可以。

假设这里的“commit number”指的是提交哈希:

git log <commit-hash>..HEAD

如果这里有人试图找出如何通过git log的输出进行LESS,从某个提交开始,向后分页,它就像git log <hash>一样简单。

像hash..HEAD这样的范围似乎不能可靠地按历史顺序产生结果,而像——author-date-order这样的选项似乎会被忽略。

要获得自给定哈希以来的所有历史提交,我发现这样的东西是唯一正确的解决方案(Bash):

git log --author-date-order --all --reverse --after="$(git show -s --format='%at' COMMIT_HASH)"
git rev-list <since_hash>..HEAD

或者包含commit:

git rev-list <since_hash>^..HEAD

你也可以使用git log而不是git rev-list来获取更多的详细信息。