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 git config remote.mob.fetch >/dev/null 2>/dev/null; then
59 if test `git rev-list .."${remote}/${branch#refs/heads/}" -- | wc -l` = 0; then
60 echo "Current branch $lbranch is up to date."
64 $gitk HEAD..."${remote}/${branch#refs/heads/}" --
65 if test -z "$action"; then
66 echo -n "(r)ebase/(m)erge/(q)uit ? "
76 git diff-index --quiet --cached HEAD --ignore-submodules -- &&
77 git diff-files --quiet --ignore-submodules
81 no_changes || unclean=t
86 test -z "$unclean" || git stash save "git-up stash"
87 git rebase "${remote}/${branch#refs/heads/}"
88 cd "$(dirname "$(git rev-parse --git-dir)")" && git submodule update --rebase
91 test -z "$unclean" || git stash save "git-up stash"
92 git merge "${remote}/${branch#refs/heads/}"
95 echo 1>&2 "no action specified"
100 if test -n "$unclean"; then
101 if test -d "$(git rev-parse --git-dir)/../.dotest"; then
103 echo "run 'git stash apply' when rebase is finished"