Created
October 24, 2008 18:33
-
-
Save chrisk/19544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ~/bin/git-notpushed | |
# | |
# Shows commits you haven't pushed to the remote yet. Optionally | |
# accepts same arguments as git-log. Assumes 'trunk' is the | |
# default remote if no branch.<current>.remote configuration exists. | |
# | |
# Uses git-svn instead of pure git; see comments below. | |
# | |
# Usage: | |
# git notpushed [arguments to git log] | |
# | |
curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') | |
origin=$(git config --get "branch.$curr_branch.remote") | |
origin=${origin:-trunk} | |
# for pure git, use this line instead to default to branch.origin.remote: | |
# origin=${origin:-origin} | |
# turn off the pager | |
git config pager.log false | |
git log --pretty=tformat:"%Cred%h%Creset %s (%ar)" $@ $curr_branch ^remotes/$origin -- | |
# for pure git, use this line instead: | |
# git log $@ $curr_branch ^remotes/$origin/$curr_branch -- | |
# reset pager to default | |
git config --unset pager.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment