前期调研参考:
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 %