在同步代码的过程中,通常在同一个代码仓库中会有多个remote
, 现在有两个remote A
和 remote B
, 将 A 的代码同步到 B 上。
通常的操作如下:
- 在 当前的代码仓库中添加
remote B
git remote add b http://xx.xx.xx.xx.git
- 在当前项目中拉取
remoteB
中的更改
git pull B branchName
-
这个时候,在没有冲突的情况下,会输入这次的merge信息,此时按
esc
然后输入:wq
之后即可。 -
然后将
remoteA
代码push
到remote B
git push B branchName
注意,这里需要确保两个
remote
中的分支名称一致。