GIT实践:合并本地仓库与远程仓库

GIT实践:合并本地仓库与远程仓库

情景描述

  我们要做的是将毫无关联的本地仓库与远程仓库进行合并。

合并仓库

1、新增远程仓库地址

  本地仓库,首先需要添加远程仓库地址

git remote add origin https://gitee.com/mrsaber/leetcode.git

2、关联远程分支

   创建本地开发分支:

git checkout -b develop

  关联远程分支:

git branch --set-upstream-to=origin/develop develop

3、PULL远程仓库代码

  因为两个仓库毫无关联,所以在PULL的时候需要增加参数 -- allow-unrelated-histories ,否则会报错。

  

4、提交本地代码并PUSH

  到这里就是常规操作了,整个业务流程还是比较清晰的。

git add .
git commit -m hello,world
git push
原文地址:https://www.cnblogs.com/MrSaver/p/12127996.html