1

I want to list all commits added to feature branch that are not on master. Something like a list of commits on github pull request page.

I've periodically pulled from master but also have some local merges (both sides belong to feature branch) since there were many people working in that branch so I can't exclude all merges or limit to first parent.

There are similar questions that suggest git log master..feature but when I've tried that it also listed commits from master that were merged into feature. Adding --cherry or changing to triple dot didn't help at all and the former breaks gitk.

Community
  • 1
  • 1
Marcin Wisnicki
  • 4,511
  • 4
  • 35
  • 57
  • According to git-rev-parse man page: "This set operation appears so often that there is a shorthand for it. When you have two commits r1 and r2 (named according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 excluding those that are reachable from r1 by ^r1 r2 and it can be written as r1..r2." Git log master..feature should show all commits reachable from feature and NOT reachable from master, so, there is now way you see any commit from master when doing git log master..feature. – dseminara Sep 11 '14 at 17:17
  • You are correct and thanks for pointing to authoritative documentation. Turns out I was comparing wrong things. – Marcin Wisnicki Sep 12 '14 at 08:54

2 Answers2

0

I think you want git cherry. It will find those commits that hasen't yet been merged to upstream (in your case that's master).

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
0

Now I realize my mistake. I was doing master..feature but my local master branch was far behind origin/master from which I was doing merges. Using git log origin/master..feature is a far better choice.

Marcin Wisnicki
  • 4,511
  • 4
  • 35
  • 57