From 51869b6a844d95111b362867cce7f010d9a54728 Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 16 Oct 2021 19:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dshell=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/share.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/share.sh b/shell/share.sh index f722f8bf..3a6ac7ef 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -274,9 +274,9 @@ git_clone_scripts() { local url=$1 local dir=$2 local branch=$3 - [[ $branch ]] && local cmd="-b $branch " + [[ $branch ]] && local part_cmd="-b $branch " echo -e "开始克隆仓库 $url 到 $dir\n" - git clone $cmd $url $dir + git clone $part_cmd $url $dir exit_status=$? } @@ -284,12 +284,12 @@ git_pull_scripts() { local dir_current=$(pwd) local dir_work="$1" local branch="$2" - [[ $branch ]] && local cmd="origin/${branch}" + [[ $branch ]] && local part_cmd="origin/${branch}" cd $dir_work echo -e "开始更新仓库:$dir_work\n" git fetch --all exit_status=$? - git reset --hard $cmd + git reset --hard $part_cmd git pull cd $dir_current } @@ -300,12 +300,12 @@ reset_romote_url() { local url=$2 local branch="$3" - [[ $branch ]] && local cmd="origin/${branch}" + [[ $branch ]] && local part_cmd="origin/${branch}" if [ -d "$dir_work/.git" ]; then cd $dir_work git remote set-url origin $url >/dev/null - git reset --hard $cmd >/dev/null + git reset --hard $part_cmd >/dev/null cd $dir_current fi }