Show commits on a specific feature branch after branch is merged and deleted

Viewed 104

We use the feature branch style in git. This means we open a branch, work on it, merge and then delete the branch (the default in applications like Bitbucket, which we use). We have a few developers and a complex tree. I would like to be able to show something specific on the tree. If i check the GUI generated log from tortoise-git i can see this:

enter image description here

The red line indicated is a feature branch that had several developers working on it. As an important note, it excludes commits that are coming from other merges (the red squares in the image).

I would like to be able to show only the commits that appear on this line (merges commits included, but not commits from before the first side of the merge), as a list in the git terminal. How can I do this?

I would have thought something like git log --second-parent (if it existed) would do the trick. Obviously tortoise-git can identify these commits, what is the command to do the same?


Things that don't work:

git log Commit-Where-Branch-Started..Commit-Where-Branch-Merged
As above but with --branches
2 Answers
git log --first-parent  $merge^2

with $merge being any way of spelling the merge commit, git's msg-search syntax can be handy, since merge messages are generally "Merge branch 'red'",

redmerge=`git rev-parse :/Merge branch 'red'"`
git log --first-parent  $redmerge^2

or probably

git log --first-parent  $(git rev-parse ":/'red'")^2

or just c&p the hash code off an exploratory log result. I'm guessing tortoise doesn't back its pretty pictures with any data you can copy from, though if it used SVG for display it could, have you tried rclicking on the top red square to see if it'll let you copy the commit id?

Assuming you still have the deleted commits in the local reflog you could recreate the branch as explained in this answer:

git checkout -b <branch> <sha>

And then compare with the branch that was used for branching:

git log master..
Related