I'm usually working on a branch that is diverged from master. So while I'm developing things, I perform git merge master
once in a while. And sometimes I wanna know when was the last time, I did git merge master
on that branch. I know I can do git log
and look for "Merge branch 'master'", and see the Date of the commit… but if there is a magic, I'd like to know!
3 Answers
git show :/"Merge branch 'master'"

- 3,591
- 1
- 14
- 8
-
interesting, I didn't know rev-parse understood regexen. I'm gonna use that in the future (though not for this :) just to replace some of the `git log --grep` style searches) – sehe Nov 16 '11 at 21:13
I personally like to inspect the difference in revision trees:
git log --graph --left-right --cherry-pick --oneline branch1...branch2
Also, in the 'magic' department there is
git show-branch
git show-branch branch1 branch2
git show-branch --all # which does all of the above and more
And finally,
git merge-base branch1 branch2
to name the base revision that would be merged from
Notes:
- replace
branch1
andbranch2
as appropriate for your project - you can alias those commands if you like them: http://progit.org/book/ch2-7.html#git_aliases
- the
--cherry-pick
options carries a rare kind ofmagic
:
--cherry-pick
Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference.
For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right, like the example above in the description of that option. It however shows the commits that were cherry-picked from the other branch (for example, "3rd on b" may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output.

- 374,641
- 47
- 450
- 633
You could use git merge-base
to get the common ancestor, and display the results.
Something like this:
git merge-base HEAD master | git show --pretty

- 44,610
- 13
- 70
- 69