determine ancestry references between two commits in git

597 Views Asked by At

Let's assume we have two commits A and B in the same repository and that A is an ancestor of B.
That has been checked with exist status 0 for:

git merge-base --is-ancestor A B

or, in older way if the output from the following two commands is identical:

git merge-base A B
git rev-parse A

I would like to know if there is a git command or simple solution to find the representation of B based on A using ancestry references, using ^ and ~.

If there are multiple paths, what I need for now is to find the fastest path that has the least number of non-first parent path (^n, n>1). From my calculation there are no two path that have the same number of non-first parents in it's path.

The results could look like this:
A~3, A~4^2~3, A^^3~2

0

There are 0 best solutions below