- 先拉去
项目1
$ git clone xxx(project1的地址)
- 在
项目1上添加一个新的远程
$ git remote add origin2 xxx(project2的地址)
- 验证是否新建远程成功
$ git remote -v
4. 抓去
项目2
# commit 全部同步在 项目1 中。
$ git fetch origin2
- 合并
项目2的分支到项目1中
# --allow-unrelated-histories 允许不想关历史合并
$ git merge origin2/b --allow-unrelated-histories
- 处理合并冲突 - 本地
- 提交合并请求
$ git commit -a -m'合并project2的b分支到当前项目'
- 移除
项目2的远程库
$ git remote rm origin2