git - 列出 git 中 2 个提交哈希之间的提交

标签 git commit

我知道这里有非常相似的问题,但他们没有解决我的问题。 可能有些地方我不太了解。

这是 fitnesse ( https://github.com/unclebob/fitnesse/ ) 提交历史的一部分:

* | | | | | | | | | | | | | | | fa86be8 Avoid possible issue when using CachingPage under heavy memory load.
|/ / / / / / / / / / / / / / /  
* | | | | | | | | | | | | | |   7b4a07a Merge pull request #256 from barredijkstra/fitnesse_issue_250
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
| * | | | | | | | | | | | | | | ecf5891 Fixed test checking for OS specific exception message.
| * | | | | | | | | | | | | | | 082236e Added rendering of cause exceptions. Fix for unclebob/fitnesse#250
* | | | | | | | | | | | | | | |   a92b37f Merge pull request #243 from amolenaar/fix/243-hash-table-rendering

我想要 2 个提交哈希值之间的提交列表。在这种特殊情况下,我希望在 ecf58917b4a07a 之间进行提交,我希望结果为:

ecf5891
7b4a07a

到目前为止,我一直在使用 git rev-list commit_hash_from_here^..commit_hash_up_to_here 并且它在线性历史上运行良好。但是,在这种情况下,我得到了更多的提交。

我试过了,效果和预期的一样:

git log --since='<date ecf5891>' --until='<date 7b4a07a>'

(我手动搜索了这 2 个日期)。

一个可能的解决方案是获取 2 个日期并执行此操作,但我认为应该有更好的方法。

编辑: 7b4a07a parent 是 ecf5891a92b37f。到目前为止,如果我想从 ecf58917b4a07a,解决方案工作正常,但如果我想从 a92b37f 7b4a07a 我想得到:

7b4a07a
ecf5891
082236e
a92b37f

但我没有得到 a92b37f

最佳答案

我认为您正在寻找 --ancestry-path ,在你的情况下:

git rev-list --ancestry-path 7b4a07a..ecf5891

关于git - 列出 git 中 2 个提交哈希之间的提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18679870/

相关文章:

git - 显示没有上游分支的所有提交

git - 我如何在 Git 中仅显示名称和自标签以来的提交标题?

oracle - 如何捕获 PL/SQL 代码中第一次提交在 Oracle 中发生的事件?

git - 删除提交的父级,从而使其成为初始提交

git - github 52 周参与如何运作?

svn - 颠覆 : Can I commit several checked-out folders at once?

git - 如何为整个团队永久删除大文件

git - 来自 Ubuntu(Windows 10 Bash)的 TFS 托管的 Git 存储库上的身份验证失败

javascript - 未捕获( promise 中)类型错误 : Failed to Fetch - In Service worker when offline

git - 从多个 git bundle 文件创建 repo