22

I have a remote repository cloned locally, and over time, I have added local commits to that cloned repository.

Now, whenever I do git status, I see Your branch is ahead of 'origin/master' by xx commits message.

Q: How do I list only commits made locally, so that I can examine these commits into more detail, and eventually merge some of them into upstream?

mr.b
  • 4,932
  • 11
  • 38
  • 55

1 Answers1

38

You can do it by specifying the range to the log command:

git log origin/master..master

Use your branch name instead of master, of course.

You can read more for example here: What are the differences between double-dot ".." and triple-dot "..." in Git commit ranges?

Also, read man gitrevisions.

Community
  • 1
  • 1
dmedvinsky
  • 8,046
  • 3
  • 31
  • 25
  • That did the trick. Thanks. Quite often I forget which tool is right for which job in git, given the abundance of commands. :) – mr.b Sep 29 '11 at 20:27
  • is there a way to find *all* differences between beginning of the branch and now? It seems to me that this command only lists commits since last commit that exists in local but not in remote repo.. – mr.b Oct 01 '11 at 15:56