ql bot添加重置remote地址

This commit is contained in:
hanhh
2021-06-21 22:41:19 +08:00
parent 173b87a7b1
commit c9fecae67a
3 changed files with 18 additions and 17 deletions
+17
View File
@@ -299,6 +299,23 @@ git_pull_scripts() {
cd $dir_current
}
## 重置仓库remote urldocker专用,$1:要重置的目录,$2:要重置为的网址
reset_romote_url() {
local dir_current=$(pwd)
local dir_work=$1
local url=$2
local branch="$3"
[[ $branch ]] && local 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
cd $dir_current
fi
}
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
detect_termux
detect_macos