Git find the oldest common ancestor of two branches

Viewed 327

I tried git merge-base, but it only provides the most recent common ancestor of two branches rather than the oldest one. Could anyone help me?

Thanks!!

1 Answers
  1. Run git merge-base --all.
  2. Run git rev-list --max-parents 0 on the result(s); these are the potential answers.
  3. Define "oldest" for your purposes and select one of the commits shown in step 2. (Depending on your definition, adding --topo-order and choosing the last one output might suffice.)
Related