What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:
git log $(git merge-base HEAD branch)..branch
The documentation for git-diff indicates that git diff A...B
is equivalent to git diff $(git-merge-base A B) B
. On the other hand, the documentation for git-rev-parse indicates that r1...r2
is defined as r1 r2 --not $(git merge-base --all r1 r2)
.
Why are these different? Note that git diff HEAD...branch
gives me the diffs I want, but the corresponding git log command gives me more than what I want.
In pictures, suppose this:
x---y---z---branch / ---a---b---c---d---e---HEAD
I would like to get a log containing commits x, y, z.
git diff HEAD...branch
gives these commits- however,
git log HEAD...branch
gives x, y, z, c, d, e.