Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

How to find the most recent common ancestor of two Git branches?

1 Answer

0 votes
by (27.5k points)

The command, git merge-base will work like a charm in this case:

$ git merge-base featureBranch developBranch

Additional info: If featureBranch is your current branch, you can use use '--fork-point' as shown below:

$ git merge-base --fork-point develop

Also, for full commit info you can use this command:

$ git log -1 $(git merge-base --fork-point develop)

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...