diff branch changes in git relative to common ancestor

After extensively looking at git help rev-parse and experimenting around, I found this piece of information:

   <rev1>..<rev2>
       Include commits that are reachable from <rev2> but exclude those
       that are reachable from <rev1>. When either <rev1> or <rev2> is
       omitted, it defaults to HEAD.

   <rev1>...<rev2>
       Include commits that are reachable from either <rev1> or <rev2>
       but exclude those that are reachable from both. When either <rev1>
       or <rev2> is omitted, it defaults to HEAD.

Somehow I was always under the impression, that master..branch is what I need and forgot about master...branch (with three dots).

But experimenting with it showed, that the three-dot notation is exactly what I’m looking for:

$ git diff master...branch

shows only the differences of branch relative to where it took off of master.

Leave a Comment