44

I have made commits to my local branch (let's just say master) and have 'git pull'd down changes that others have made. When I run a 'git status', I see something like:

# Your branch is ahead of 'origin/master' by 4 commits.

How can I see a list of the four commits that I have made that have yet to be pushed to origin?

markdorison
  • 139,374
  • 27
  • 55
  • 71

2 Answers2

69
git diff --stat origin/master

will show the changed files.

git log origin/master..master

will show the commits.

Anti Veeranna
  • 11,485
  • 4
  • 42
  • 63
ebneter
  • 20,795
  • 9
  • 30
  • 30
  • 2
    In recent versions of it, if you've set upstream information properly you can use something like `git log @{u}..`. – Lily Ballard Nov 02 '10 at 23:03
  • You can do the same with gitk, either using the "views" interface inside it, or just by launching it as `gitk origin/master..master`. – Cascabel Nov 03 '10 at 00:49
  • how do i check the different in files between origin and the file I have? – Dilip Dec 07 '15 at 06:51
2

I tend to use gitk (or gitk --all) which will show this history of the branch. It also displays large friendly labels on origin/master and master (and any other tags that you have).

A more lo tech version is git log --graph

Eric
  • 21
  • 1
  • 1
    'git log --graph' is great but if there have been a lot of more recent commits from others, it is tough, if not impossible, to tell what are the commits I have yet to push. – markdorison Nov 02 '10 at 22:23