+ if $gotoupstream; then
+ if ! $force; then
+ msg "Must also use -f (delete local changes) when using -u"
+ exit 1
+ fi
+ if $gotomaster; then
+ if $fetchupstream; then
+ verbose git fetch origin
+ verbose git remote prune origin
+ fi
+ verbose git checkout -f "`repobranch "$d"`"
+ verbose git reset --hard origin/"`repobranch "$d"`"
+ else
+ r=`git symbolic-ref HEAD`
+ r=${r#refs/heads/}
+ rem=`git config "branch.$r.remote" || echo origin`
+ bra=`git config "branch.$r.merge" || echo "$r"`
+ upstream="$rem/${bra#refs/heads/}"
+ if $fetchupstream; then
+ verbose git fetch "$rem"
+ verbose git remote prune "$rem"
+ fi
+ if ! git rev-parse "$upstream" >/dev/null 2>&1; then
+ upstream="origin/`repobranch "$d"`"
+ fi
+ verbose git reset --hard "$upstream"
+ fi
+ elif $gotomaster; then
+ if $force; then
+ verbose git checkout -f "`repobranch "$d"`"
+ verbose git reset --hard
+ else
+ verbose git checkout "`repobranch "$d"`"
+ fi
+ elif $force; then