代码从A库迁移到B库

方案一:完整迁移 A ---> B(包含所有分支)

1. 克隆 A 仓库(使用 --mirror 表示镜像整个仓库,包括所有 refs)
git clone --mirror https://github.com/user/a.git

2. 进入本地仓库 cd a.git

3. 推送到 B 仓库 git push --mirror https://github.com/user/b.git

这种迁移方式,可以把所有的分支都迁移到新的仓库。

 

如果用 git clone https://github.com/user/a.git 这种方式,默认只会克隆main分支。

 

posted @ 2025-06-13 17:47  羊脂玉净瓶  阅读(9)  评论(0)    收藏  举报