Git identify the most recent intersection of two branches

Is there an abbreviation for the last commit common to two branches? For example, if I have a master, then topic1 is separated from the master, and they both continue

master:
a------b------c------d
        \
topic1:  r------s------t

Is there a way to define say b?
For example, if there was such a thing as master # topic1 (the same as topic1 # master), which meant "the very last fixer shared by both the master and the theme."

I would like to be able to:

$ git checkout topic1
$ git diff master#topic1..topic1

I know what I can do:

git diff master..topic

but i don't need commits cand d.

+5
source share
2 answers

The answer to your question:

git diff master...topic

Pay attention to three points.

From the man page:

git diff [--options] <commit>...<commit> [--] [<path>...]

, , <commit>. git diff A...B git diff $(git merge-base A B) B. <commit>, , HEAD.

+7

git merge-base.

NAME
git-merge-base - Find as good common ancestors as possible for a merge

SYNOPSIS
git merge-base [-a|--all] [--octopus] <commit> <commit>…
git merge-base --independent <commit>…
+5

All Articles