Showing the Commits You've Yet to Push in Git
08 Jul 2010
If you’re using Git, and have set up a local branch that tracks a remote branch, you’ll probably have seen the following message in your git status at some point:
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
This tells us that there are two commits in this branch that don’t exist in the remote branch. To find out which commits these are, we can do the following:
git log origin/master..
Note the double period – it’s not a typo.
This command can be used to compare the branch you’re currently on with any other branch, showing the commits yet to be pushed.
To see commits on the remote branch you have yet to pull, use:
git log origin/master...