情景描述

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

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 ,否则会报错。

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

4、提交本地代码并PUSH

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

git add .
git commit -m hello,world
git push

相关文章:

  • 2021-12-07
  • 2018-08-25
  • 2022-01-29
  • 2021-06-24
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2022-02-11
  • 2022-12-23
  • 2021-07-06
  • 2021-09-24
  • 2018-04-17
相关资源
相似解决方案