修改重置分支shell

This commit is contained in:
whyour 2022-03-07 23:40:49 +08:00
parent 6f2e7b9459
commit f6dc0e020f

View File

@ -324,8 +324,9 @@ git_pull_scripts() {
set_proxy set_proxy
git fetch --all git fetch --all
exit_status=$? exit_status=$?
git pull --allow-unrelated-histories git pull &>/dev/null
unset_proxy unset_proxy
reset_branch "$branch"
cd $dir_current cd $dir_current
} }
@ -342,14 +343,19 @@ reset_romote_url() {
git remote set-url origin $url &>/dev/null git remote set-url origin $url &>/dev/null
local part_cmd="" local part_cmd=""
reset_branch "$branch"
cd $dir_current
fi
}
reset_branch() {
local branch="$1"
if [[ $branch ]]; then if [[ $branch ]]; then
part_cmd="origin/${branch}" part_cmd="origin/${branch}"
git checkout -B "$branch" git checkout -B "$branch"
git branch --set-upstream-to=$part_cmd $branch git branch --set-upstream-to=$part_cmd $branch
fi fi
git reset --hard $part_cmd &>/dev/null git reset --hard $part_cmd &>/dev/null
cd $dir_current
fi
} }
random_range() { random_range() {