Andrew Arnott
Andrew Arnott

Reputation: 81781

How to get a merge log for a branch?

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.

Upvotes: 3

Views: 272

Answers (2)

Jakub Narębski
Jakub Narębski

Reputation: 323444

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

Upvotes: 4

VonC
VonC

Reputation: 1323773

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.

Upvotes: 2

Related Questions