Show commits involved in a prior git merge

The Pixel Developer picture The Pixel Developer · May 31, 2011 · Viewed 25.6k times · Source

Say I create a hotfix branch off of a develop branch, make two commits, merge this back to the develop branch, and destroy the hotfix branch.

How do I find out what commits were part of the merge? Is that possible?

Answer

Jesse picture Jesse · May 7, 2014

Say your merge commit is ab2f8173, git log ab2f8173^..ab2f8173 will show the commits which it merged in.

Here is how to turn this into a git alias for easy re-use:

$ git config --global alias.merge-log '!f() { git log --stat "$1^..$1"; }; f'
$ git merge-log 0865c12