五步迁移代码:从A仓库迁移到B仓库,携带提交记录。

前期调研参考:
1、https://developer.aliyun.com/article/1123638
2、https://zhuanlan.zhihu.com/p/443302025

一、

old-project % git remote -v
// origin  git@gitlab.AAAAAA (fetch)
// origin  git@gitlab.AAAAAA (push)
old-project % git remote add new_remote_name1 git@gitlab.BBBBBBB
old-project % git remote -v                                                         
// newName        git@gitlab.BBBBBBB (fetch)
// newName        git@gitlab.BBBBBBB (push)
// origin  git@gitlab.AAAAAA (fetch)
// origin  git@gitlab.AAAAAA (push)
old-project % git branch 
// * master
//   trunk-master2
//   trunk-master3
old-project % git checkout trunk-master2
// Switched to branch 'trunk-master2'
// Your branch is up to date with 'origin/trunk-master2'.
old-project % git push new_remote_name1 trunk-master2
// Enumerating objects: 26162, done.
// Counting objects: 100% (26162/26162), done.
// Delta compression using up to 4 threads
// Compressing objects: 100% (24311/24311), done.
// Writing objects: 100% (26162/26162), 21.49 MiB | 16.51 MiB/s, done.
// Total 26162 (delta 105), reused 26162 (delta 105), pack-reused 0
// remote: Resolving deltas: 100% (105/105), done.
// To git@gitlab.BBBBBBB
//  * [new branch]        trunk-master2 -> trunk-master2
old-project % 

#如果需要同步其他分支、需要切换到其他分支之后,在进行、gitpush动作
old-project % git branch    
//   master
//   trunk-master2
// * trunk-master3
old-project % git pull 
// Already up to date.
old-project % git push trunk-master3 new_remote_name1
// Enumerating objects: 685, done.
// Counting objects: 100% (685/685), done.
// Delta compression using up to 4 threads
// Compressing objects: 100% (608/608), done.
// Writing objects: 100% (650/650), 127.12 KiB | 6.69 MiB/s, done.
// Total 650 (delta 203), reused 446 (delta 0), pack-reused 0
// remote: Resolving deltas: 100% (203/203), completed with 23 local objects.
// To git@gitlab.BBBBBBB
//  * [new branch]        trunk-master3 -> trunk-master3
old-project % 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值