views:

94

answers:

2

git log lists all commits, from all branches that have been merged into HEAD. I want to get a list of merges, so I can see which branches have been merged into this one, and when.

How can I get that information? I'm looking for something besides "launch gitk and look at the graph", since I know that one, but for very large histories with many branches this doesn't scale very well. A text result to a text query is probably ideal.

+2  A: 

According to this thread, playing a bit with git log:

$ git log --no-walk $(git rev-list --parents HEAD | sed -n "s/ .* .*//p")

would give you the list of merges since the last tag in a repository.
Not fully tested myself though.

VonC
It seems to go well past the last tag, but this is exactly what I want. The complexity of the command is a testament to the flexibility of git, but also it's *complexity*. :|
Andrew Arnott
Or you can use `git log --merges` with git version 1.6.4 or newer.
Jakub Narębski
+4  A: 

With modern git (if you have version 1.6.4 or newer you have this) you can use simply

$ git log --merges

If you want to see only merges into current branch, you can add --first-parent option:

$ git log --merges --first-parent
Jakub Narębski
Excellent! I should read those release notes more carefully ;) +1
VonC