Skip to content

Instantly share code, notes, and snippets.

@grassdog
Created August 18, 2011 00:27
Show Gist options
  • Save grassdog/1153005 to your computer and use it in GitHub Desktop.
Save grassdog/1153005 to your computer and use it in GitHub Desktop.
Script to show which commits aren't pushed to a remote
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment