I find myself recurrently in a situation, where I want to see the diff of all changes, that a branch introduced since branching off. The naive
$ git diff ..branch
doesn't work well, because changes in master
are taken into account as well. What I'm looking for is basically a nicer way to run
$ git diff $(git merge-base master branch)..branch
or expressed in graphics:
---A---B---C---D---E <== master
\
F---G---H <== branch
How do I elegantly find the diff between B
and H
?
Edit: As noted in my answer below, master...branch
is a solution to my problem. However, I still don't know, why that's the case, given the quoted man page snippet.
Why does diff master...branch
only show the differences from the merge base, while man rev-parse
says, it should include master
's commits, too?
Why does diff master..branch
show the diff between the current state of master
and branch
, while man rev-parse
says, it should ignore the master
-only commits?