Viewing unpushed Git commits

Josh Buhler picture Josh Buhler · Jan 6, 2010 · Viewed 928.3k times · Source

How can I view any local commits I've made, that haven't yet been pushed to the remote repository? Occasionally, git status will print out that my branch is X commits ahead of origin/master, but not always.

Is this a bug with my install of Git, or am I missing something?

Answer

Peter B picture Peter B · Jan 6, 2010
git log origin/master..HEAD

You can also view the diff using the same syntax

git diff origin/master..HEAD