记一次跨项目合并代码

84 阅读1分钟

关联另一个项目

git remote add other git@github.com:nanjingcaiyong/xxx.git

将另一个项目的信息拉取到本地(分支、标签、提交记录等)

git fetch other

合并代码

git merge other/xxx

# fatal: 拒绝合并无关的历史

因为当前项目分支和另一个项目提交记录没有关联,所以我们要告诉 git 允许合并无关历史的记录 --allow-unrelated-histories

git pull self/moeny --allow-unrelated-histories