3 . "$(dirname "$0")/setup.sh"
6 $(basename $0) [options] [<remote> [<branch>]]
8 k,gitk visualize unmerged differences
9 r,rebase perform a rebase
10 m,merge perform a merge
13 . "$(git --exec-path)/git-sh-setup"
16 lbranch=$(git symbolic-ref HEAD | sed -e s~refs/heads/~~)
17 remote=$(git config --get "branch.$lbranch.remote" || echo origin)
18 branch=$(git config --get "branch.$lbranch.merge" || echo "refs/heads/$lbranch")
20 case "$(git config --bool --get madcoder.up-gitk)" in
24 case "$(git config --bool --get "branch.$lbranch.rebase")" in
29 while test $# != 0; do
36 shift; action=rebase;;
38 shift; rebase=${rebase#rebase};;
42 shift; rebase=${rebase#merge};;
53 2) remote="$1"; branch="$2";;
58 if git config remote.mob.fetch >/dev/null 2>/dev/null; then
61 if test `git rev-list .."${remote}/${branch#refs/heads/}" -- | wc -l` = 0; then
62 echo "Current branch $lbranch is up to date."
66 $gitk HEAD..."${remote}/${branch#refs/heads/}" --
67 if test -z "$action"; then
68 echo -n "(r)ebase/(m)erge/(q)uit ? "
78 git diff-index --quiet --cached HEAD --ignore-submodules -- &&
79 git diff-files --quiet --ignore-submodules
83 no_changes || unclean=t
88 test -z "$unclean" || git stash save "git-up stash"
89 git rebase "${remote}/${branch#refs/heads/}"
90 cd "$(dirname "$(git rev-parse --git-dir)")" && git submodule update --rebase
93 test -z "$unclean" || git stash save "git-up stash"
94 git merge "${remote}/${branch#refs/heads/}"
97 echo 1>&2 "no action specified"
102 if test -n "$unclean"; then
103 if test -d "$(git rev-parse --git-dir)/../.dotest"; then
105 echo "run 'git stash apply' when rebase is finished"