From f0d2d575842c03a0623bf3f254ee57c68838c92a Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 24 Feb 2022 22:22:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgit=20reset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/share.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/share.sh b/shell/share.sh index 63f975e2..62a43e10 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -316,15 +316,15 @@ git_pull_scripts() { local dir_current=$(pwd) local dir_work="$1" local branch="$2" - [[ $branch ]] && local part_cmd="origin/${branch}" + [[ $branch ]] && git checkout ${branch} cd $dir_work echo -e "开始更新仓库:$dir_work\n" set_proxy git fetch --all exit_status=$? - git reset --hard $part_cmd - git pull + git reset --hard &>/dev/null + git pull &>/dev/null unset_proxy cd $dir_current @@ -341,8 +341,8 @@ reset_romote_url() { if [[ -d "$dir_work/.git" ]]; then cd $dir_work [[ -f ".git/index.lock" ]] && rm -f .git/index.lock >/dev/null - git remote set-url origin $url >/dev/null - git reset --hard $part_cmd >/dev/null + git remote set-url origin $url &>/dev/null + git reset --hard $part_cmd &>/dev/null cd $dir_current fi }