两个git仓库代码合并
由于在开发时,并没有从master分支拉取分支,直接复制代码进行测试,造成在两个机器上产生两个不同版本的repo1_test 和repo2_test仓库。 后续开发需要基于两个测试完成后合并的master分支。现将两个不同版本的repo1_test 和repo2_test仓库需要合并到master分支。也就是完成下图所示的工作流程: a master C repo1_test D repo_2_test 1 从repo1_test和repo2_test克隆出空git仓库 git clone --bare <workspace>/.git repo1_test.git 2 在mster中将repo1_test添加为远端仓库,并设置别名repo1 git remote add repo1 <file path>/repo1_test.git 3 从repo1_test中拉去数据到本仓库 git fetch repo1 4 从远端repo1仓库的master分支拉取数据作为新分支checkout到本仓库的新分支feature/repo1 git checkout -b feature/repo1 repo1/master 5 我们在feature/repo1分支下将master分支进行合并,以免对主分支的代码造成影响。 git merge master 此时应该会报错 fatal: