#!/bin/bash branch="$1" if [ "$1" = "" ]; then echo "branch is empty" exit 1 else echo "branch is $1" fi function checkout() { local repository="$1" out=$(git -C "$repository" checkout -b "$branch" 2>&1 || git -C "$repository" checkout "$branch" 2>&1 ) if [ ! -z $? ]; then echo " *** $repository checkout failed *** " echo "$out" echo "" else out=$(git -C "$repository" pull 2>&1) if [ ! -z $? ]; then echo " *** $repository pull failed *** " echo "$out" echo "" fi fi } checkout "../ui.scripts" checkout "../ui.config" checkout "../common"