参考网站如下:
https://blog.csdn.net/u011521382/article/details/83859190
https://www.jianshu.com/p/42a10bbfbf97
https://blog.csdn.net/I_recluse/article/details/93619400
这里举例两个远程仓库com_bestyii_AAA和com_bestyii_BBB_bd
将com_bestyii_AAA某一次提交合并到com_bestyii_BBB_bd上边
步骤如下
通过路径或者git地址,例如
//git remote add 仓库名称 路径
git remote add com_bestyii_AAA_bj path/to/com_bestyii_AAA
//git remote add 仓库名称 地址
git remote add com_bestyii_AAA_bj git@github.weiwei.com:company/com_bestyii_AAA.git
现在git remote 一下可以看见本地有两个远程仓库
com_bestyii_AAA_bj
origin
git fetch com_bestyii_AAA_bj //git fetch 仓库名称
通过git branch -a看到仓库下的所有分支情况
* master
remotes/com_bestyii_AAA_bj/master
remotes/origin/HEAD -> origin/master
remotes/origin/master
这一步是将远程主仓库的代码在本地新建一个分支,稍后会将这个分支的代码和本地代码merge,这样也就是将主仓库代码和自己仓库的代码merge了
git checkout -b bj_master com_bestyii_AAA_bj/master
git log
这里注意切换分支的命令为
git checkout master //git checkout 分支名
git cherry-pick 7fcb3defff
git push