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 diff-index --quiet --cached HEAD --ignore-submodules -- &&
74 git diff-files --quiet --ignore-submodules
78 no_changes || unclean=t
83 test -z "$unclean" || git stash save "git-up stash"
84 git rebase "${remote}/${branch#refs/heads/}"
85 cd "$(dirname "$(git rev-parse --git-dir)")" && git submodule update --rebase
88 test -z "$unclean" || git stash save "git-up stash"
89 git merge "${remote}/${branch#refs/heads/}"
92 echo 1>&2 "no action specified"
97 if test -n "$unclean"; then
98 if test -d "$(git rev-parse --git-dir)/../.dotest"; then
100 echo "run 'git stash apply' when rebase is finished"