4 $(basename $0) [options] [<remote> [<branch>]]
6 k,gitk visualize unmerged differences
7 r,rebase perform a rebase
8 m,merge perform a merge
11 . "$(git --exec-path)/git-sh-setup"
14 lbranch=$(git symbolic-ref HEAD | sed -e s~refs/heads/~~)
15 remote=$(git config --get "branch.$lbranch.remote" || echo origin)
16 branch=$(git config --get "branch.$lbranch.merge" || echo "refs/heads/$lbranch")
18 case "$(git config --bool --get madcoder.up-gitk)" in
22 case "$(git config --bool --get "branch.$lbranch.rebase")" in
27 while test $# != 0; do
34 shift; action=rebase;;
36 shift; rebase=${rebase#rebase};;
40 shift; rebase=${rebase#merge};;
51 2) remote="$1"; branch="$2";;
56 if test `git rev-list .."${remote}/${branch#refs/heads/}" -- | wc -l` = 0; then
57 echo "Current branch $lbranch is up to date."
61 $gitk HEAD..."${remote}/${branch#refs/heads/}" --
62 if test -z "$action"; then
63 echo -n "(r)ebase/(m)erge/(q)uit ? "
73 git rev-parse --verify HEAD > /dev/null && \
74 git update-index --refresh && \
75 git diff-files --quiet && \
76 git diff-index --cached --quiet HEAD -- || unclean=t
80 test -z "$unclean" || git stash save "git-up stash"
81 git rebase "${remote}/${branch#refs/heads/}"
84 test -z "$unclean" || git stash save "git-up stash"
85 git merge "${remote}/${branch#refs/heads/}"
88 echo 1>&2 "no action specified"
93 if test -n "$unclean"; then
94 if test -d "$(git rev-parse --git-dir)/../.dotest"; then
96 echo "run 'git stash apply' when rebase is finished"