Git :列出修订版 A 的 children 和修订版 B 的 parents 的所有提交
Git : list all commits that are both children of revision A and parents of revision B
版本 A 已有几天,版本 B 已有几个月。然而,当使用 git log A..B
或 git log A...B
时,我得到的是几年前的修订。这对我来说毫无意义。我如何挑出 both children of A and parents of B 的提交历史?
您可以使用 --ancestry-path
option of git log
:
--ancestry-path
When given a range of commits to display (e.g. commit1..commit2
or commit2 ^commit1
), only display commits that exist directly on the ancestry chain between the commit1
and commit2
, i.e. commits that are both descendants of commit1
, and ancestors of commit2
.
在你的情况下,你会说:
git log --ancestry-path A..B
获取既是 A
的子项又是 B
的父项的提交。
版本 A 已有几天,版本 B 已有几个月。然而,当使用 git log A..B
或 git log A...B
时,我得到的是几年前的修订。这对我来说毫无意义。我如何挑出 both children of A and parents of B 的提交历史?
您可以使用 --ancestry-path
option of git log
:
--ancestry-path
When given a range of commits to display (e.g.commit1..commit2
orcommit2 ^commit1
), only display commits that exist directly on the ancestry chain between thecommit1
andcommit2
, i.e. commits that are both descendants ofcommit1
, and ancestors ofcommit2
.
在你的情况下,你会说:
git log --ancestry-path A..B
获取既是 A
的子项又是 B
的父项的提交。