Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine whether two Git branches have diverged

Tags:

git

branch

I'd like to determine whether two Git branches have diverged or whether one of the branches could simply be fast forwarded to the other branch.

In other words, I want to check whether the current HEAD of one of the branches has been merged into the other branch at some point or if it contains commits that are not in the other branch.

Is there a way to do this without actually merging the two branches? A simple git diff does not help in this case.

like image 574
Danilo Bargen Avatar asked Dec 13 '22 03:12

Danilo Bargen


1 Answers

You can use git merge-base

A description can be found here.

like image 138
ebaxt Avatar answered Dec 28 '22 15:12

ebaxt