For lack of a better name, I made a small script called “git-notpushed”, which shows the commits you haven’t pushed to your remote yet. But you can call it whatever you want. :)
It’s basically shorthand for doing things like this a lot:
$ git log master ^origin/master
Put this in any directory in your PATH and make it executable:
1 2 3 4 5 6 7 8 9 10 11 |
#!/bin/sh
#
# Shows commits you haven't pushed to the remote yet. Accepts same
# arguments as git-log. Assumes 'origin' is the default remote if no
# branch.Foo.remote configuration exists.
curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
origin=$(git config --get "branch.$curr_branch.remote")
origin=${origin:-origin}
git log $@ $curr_branch ^remotes/$origin/$curr_branch |
Runnin’ in the wild:
~ (master) $ git-notpushed
commit 4adcfd0456e1563d5d210cd3db62a8d2a51f0953
Author: Garry Dolley
Date: Wed Dec 5 22:23:01 2007 -0800
Added more addresses
~ (master) $
Looks like I have one commit I haven’t pushed yet. I can also give git-notpushed the same arguments as git-log, should I prefer a different output format, etc…
For super brevity, you can even alias it with this in your ~/.bashrc:
alias gnp='git-notpushed' |
Have fun and let me know if this is useful to you.

Awesome, this is exactly what I have been wanting.