skip to content
Alvin Lucillo

Display common ancestor of branches

/ 1 min read

In the command below, it shows that c81ce21 is the nearest common ancestor of the two branches.

git merge-base feature1 feature2
c81ce216d498e44a1d66e2bd811d5523d2e5e045
git log --graph --oneline --decorate --all

* 63b4237 (feature2) Feature 2: version 3.2
* 326cd74 Feature 2: version 3.1
| * 14289f7 (feature1) Feature 1: version 3.2
| * fc08836 Feature 1: version 3.1
|/  
* c81ce21 (HEAD -> main) Major version 3
* 864bd19 Major version 2
* 7967f89 Major version 1
(END)