This is the inverse of how to list commits on a branch but not merged branches, so I'll ask it in the same format. Let's say my git commit history looks like this:
A---B---C---D---E---F master
\ /
X---Y---Z topic
How do I list the commits on the topic branch -- that is, X, Y, and Z? Note that simply doing git log topic won't work -- that will return commits A and B as well.
I had thought I could run git merge-base topic master to find B, and then do git log B..Z to get these commits. Unfortunately, git merge-base topic master returns Z, not B, which makes sense in retrospect -- since Z is already merged to master, the first commit between topic and master that shares history is Z.