git命令:如何把仓库分支提交到另外一个仓库

72 阅读1分钟

仓库 test_a,分支 developer_test

仓库 test_b

将仓库test_a的developer_test分支提交到仓库test_b

ps: 如果使用ssh方式拉取,需要配置,可以参考该文档:blog.csdn.net/D939030515/…

1. 先将仓库test_a拉取到本地

git clone gitee.com/*****/test_…

2. 创建一个分支,起点 master(只是用来测试,已有分支不用该步骤)

3. 添加test_b的远程地址

git remote add repo-test_b gitee.com/*****/test_…

可以看到已经有该远程路径

4. 推送developer_test分支到test_b

git push repo-test_b developer_test

如果使用另外的分支名,例如branch_b,在分支后面使用 冒号加新的分支名称

git push repo-test_b developer_test:branch_b

5.如果远程已经有该分支,推送可能会提示错误,需要先从远程拉取

6.本地merge以后,可以提交