在一个分支 A 总是 merge 到另一个 B 的分支模型中,如何列出 B 中的所有提交而不是 A 中的所有提交,同时忽略所有精心挑选的提交和 merge ?
a1-------b2' -- A
/ \ \
b1--b2--m1--b3--m2--b4 -- B
b2': cherry-picked commit
在这种情况下,它应该列出提交 b3、b4
。
git手册中的一些研究:
git-log
的 --no-merges
和 --cherry-*
选项已经解决了忽略 merge 和精选提交的问题命令。但是 --cherry-*
使用提交对称差异(即 A...B
)将 cherry-picks 匹配在一起。在此示例中,提交 b2 不是其中的一部分。 git log --cherry A...B
返回 b2, b3, b4
。
你可以重现这个例子:
mkdir reprod; cd reprod; git init
git check-out -b B
git commit -m "b1" --allow-empty
git commit -m "b2" --allow-empty
git check-out -b A B^{/b1}
git commit -m "a1" --allow-empty
git cherry-pick --allow-empty B^{/b2}
git check-out B
git merge A^{/a1} --no-edit
git commit -m "b3" --allow-empty
git merge A^{/b2} --no-edit
git commit -m "b4" --allow-empty
git log A...B --cherry
最佳答案
(失败的假设 - 保留在这里仅供历史引用)
看来你必须在这里使用 --left-only
/--right-only
。
见此paragraph .
For example,
--cherry-pick --right-only A...B
omits those commits from B which are in A or are patch-equivalent to a commit in A. In other words, this lists the + commits fromgit cherry A B
. More precisely,--cherry-pick --right-only --no-merges
gives the exact list.
这不正是您的情况吗?
https://stackoverflow.com/questions/56798783/
相关文章:
python - 如何在 Python 中使用计时器解锁条件?
python-3.x - 如何在 python 中使用 opencv 读取数据矩阵代码?
laravel - 当我部署到服务器时,Laravel 项目中的 vue 组件不会更新
swagger - 如何在开放式 API 规范中为字符串类型的属性指定空字符串值作为默认值
node.js - GCP 应用引擎 : Random pending requests for s
c++ - 使用 Microsoft Visual Studio 运行 C++ "hello wor
datetime - Flutter:DateTime.now 不反射(reflect)手动设置的时