]>
Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-outgoing
   2 # Usage: git-outgoing [-d] [<upstream>] [<head> [<limit>]] 
   3 # Show commits on current branch that do not exist on branch <upstream>. 
   5 # bail out with message to stderr and exit status 1 
   7     echo "$(basename $0):" "$@" 1>&2 
  12 SHA
=$(git config --get-color 'color.branch.local') 
  13 ADD
=$(git config --get-color 'color.diff.new') 
  14 REM
=$(git config --get-color 'color.diff.old') 
  15 RESET
=$(git config --get-color '' 'reset') 
  17 # check for -d / --diff argument 
  19 if [ "$1" = '-d' -o "$1" = '--diff' ] 
  24 # get the current branch in refs/heads/<branch> form 
  25 ref
=$(git symbolic-ref -q HEAD) 
  27 die 
"you're not on a branch" 
  29 # just the branch name please 
  30 branch
=$(echo "$ref" | sed 's@^refs/heads/@@') 
  32 die 
"you're in a weird place; get on a local branch" 
  34 # use tracking branch if no upstream given 
  37     remote
=$(git config --get "branch.$branch.remote" || true) 
  39     merge
=$(git config branch.$branch.merge) || 
  40     die 
"branch $branch isn't tracking a remote branch and no <upstream> given" 
  42     set -- "$remote/$(echo "$merge" |sed 's@^refs/heads/@@')" 
  46 then git 
diff "$1"...HEAD
 
  47 else git cherry 
-v "$@"                                | 
  49      sed -e "s/^\(.\) \(.......\)/\1 $SHA\2$RESET/"    | 
  50      sed -e "s/^-/$REM-$RESET/" -e "s/^+/$ADD+$RESET/"