45

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?

5

2 Answers 2

72
git diff --stat origin/master

will show the changed files.

git log origin/master..master

will show the commits.

3
  • 2
    In recent versions of it, if you've set upstream information properly you can use something like git log @{u}... Commented Nov 2, 2010 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
    Commented Nov 3, 2010 at 0:49
  • how do i check the different in files between origin and the file I have?
    – Dilip
    Commented Dec 7, 2015 at 6: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

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. Commented Nov 2, 2010 at 22:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.