Git:列出所有既是修订版A的孩子又是修订版B的父项的提交

问题描述

版本A有几天的历史,版本B有几个月的历史。但是,当使用git log A..Bgit log A...B时,我得到的修订版本已有很长时间了。这对我来说毫无意义。我该如何挑选A的子女的和B的父母的的提交历史?

解决方法

您可以使用--ancestry-pathgit log选项:

--ancestry-path
给定要显示的提交范围(例如commit1..commit2commit2 ^commit1)时,仅显示直接存在于commit1commit2之间的祖先链上的提交,即都是commit1的后代,也是commit2的祖先。

对于您而言,您会说:

git log --ancestry-path A..B

获取既是A的孩子又是B的父母的提交。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...