-# reslog=$(git log HEAD..origin/master --oneline)
-# if [[ "${reslog}" != "" ]] ; then
-# git merge origin/master
+ show_branch_conditionally "$this_branch"
+
+ # this code is now doing what i have to do when i repair the repo. and it seems to be good so far.
+ # note that we allow the local branch to be merged with its remote counterpart; otherwise we would
+ # miss changes that happened elsewhere which should be seen in our local copy.
+ local branch_list=$(all_branch_names)
+ local bran
+ for bran in $branch_list; do
+# echo "synchronizing remote branch: $bran"
+ git checkout "$bran" | $TO_SPLITTER
+ promote_pipe_return 0
+ test_or_die "git switching checkout to remote branch: $bran"
+
+ show_branch_conditionally "$this_branch"
+
+ remote_branch_info=$(git ls-remote --heads origin $bran 2>/dev/null)
+ if [ ! -z "$remote_branch_info" ]; then
+ # we are pretty sure the remote branch does exist.
+ git pull $PULL_ADDITION origin "$bran" | $TO_SPLITTER
+# we may want to choose to do fast forward, to avoid crazy multiple merge histories
+# without any changes in them. --no-ff
+ promote_pipe_return 0
+ fi
+ test_or_die "git pull of remote branch: $bran"
+ done
+ # now switch back to our branch.
+ git checkout "$this_branch" | $TO_SPLITTER
+ promote_pipe_return 0
+ test_or_die "git checking out our current branch: $this_branch"