28

If I have a local branch test and the remote branch is test. So if I did a push it would be push origin test:test

How can I see my local unpushed commits that I did on that branch? git log?

awesoon
  • 32,469
  • 11
  • 74
  • 99
user565660
  • 1,171
  • 3
  • 20
  • 37
  • http://stackoverflow.com/questions/1800783/compare-local-git-branch-with-remote-branch is what you are looking for, I believe – RBZ May 01 '13 at 17:46
  • chk out http://stackoverflow.com/a/3338774/556856 Works like a charm. – Sujay Jul 08 '13 at 19:08

2 Answers2

13

I generally use gitk --all for that (after a git fetch --all).

And, for console mode, I have an alias of git log --graph --all --decorate --oneline which gives a nice and compact overview of your branches. In particular, it shows what you can push.

For both these commands you can specify branches (test origin/test in your case) instead of showing them all with --all.

François
  • 7,988
  • 2
  • 21
  • 17
10

First fetch the remote's changes to your local repository:

git fetch origin test

This will place all commits from the remote's test branch in origin/test. Now you can use git log:

git log origin/test..test

That will show all commits on test that are not reachable from origin/test.

Andomar
  • 232,371
  • 49
  • 380
  • 404