From f6fb0b6ef2b0e827108156d0d08f79f5c9aeaff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= Date: Thu, 13 Mar 2025 20:55:48 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E9=85=8D=E7=BD=AE=E8=AE=B0=E5=BD=95=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- develop/Git 脚本.md | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 develop/Git 脚本.md diff --git a/develop/Git 脚本.md b/develop/Git 脚本.md new file mode 100644 index 0000000..7484478 --- /dev/null +++ b/develop/Git 脚本.md @@ -0,0 +1,47 @@ + +```bash +# 本地设置多远端 +git clone git@git.only4.work:coder-xiaomo/tutorials.git +git remote add github git@github.com:coder-xiaomo/tutorials.git +git remote add gitee git@gitee.com:coder-xiaomo/tutorials.git +git remote add gitcode git@gitcode.com:coder-xiaomo/tutorials.git + +git remote add all git@git.only4.work:coder-xiaomo/tutorials.git +git remote set-url --add all git@github.com:coder-xiaomo/tutorials.git +git remote set-url --add all git@gitee.com:coder-xiaomo/tutorials.git +git remote set-url --add all git@gitcode.com:coder-xiaomo/tutorials.git + +# 拉取全部仓库代码 +git fetch --all +git pull --all + +``` + +`.git/config` 文件部分配置如下: + +``` +[branch "main"] + remote = all + merge = refs/heads/main + +[remote "origin"] + url = git@git.only4.work:coder-xiaomo/tutorials.git + fetch = +refs/heads/*:refs/remotes/origin/* +[remote "github"] + url = git@github.com:coder-xiaomo/tutorials.git + fetch = +refs/heads/*:refs/remotes/github/* + pushurl = git@github.com:coder-xiaomo/tutorials.git +[remote "gitee"] + url = git@gitee.com:coder-xiaomo/tutorials.git + fetch = +refs/heads/*:refs/remotes/gitee/* +[remote "gitcode"] + url = git@gitcode.com:coder-xiaomo/tutorials.git + fetch = +refs/heads/*:refs/remotes/gitcode/* +[remote "all"] + url = git@git.only4.work:coder-xiaomo/tutorials.git + fetch = +refs/heads/*:refs/remotes/all/* + url = git@github.com:coder-xiaomo/tutorials.git + url = git@gitee.com:coder-xiaomo/tutorials.git + url = git@gitcode.com:coder-xiaomo/tutorials.git + +``` \ No newline at end of file