如何找到两个分支共有的提交?
如果我的分支 A 包含提交 1、2 和 3,分支 B 包含提交 2、3、4,并且我想获取提交 2 和 3 的列表(A 与 B 相交),是否有 git 命令可以执行那?
If I have branch A with commit 1, 2, and 3 and branch B with commits 2, 3, 4 and I'd like to get a list of commits 2 and 3 (A intersect B), is there a git command to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git merge-base A B
会给你提交 3(两个分支A
和B
的最新部分),但它不会给你 2,考虑到 1、2 和 3 无论如何都是两个分支的一部分。
A
git merge-base A B
would give you commit 3 (the most recent one part of both branchesA
andB
)But it won't give you 2, considering 1, 2 and 3 are part of both branches anyway.