将其他仓库的代码合到自己的仓库

  • 2022-07-07
  • 浏览 (1118)

我们有时做二次开发,或者使用不同的仓库去管理一个大的仓库,需要将一个仓库的代码合并到另外一个仓库中去。

1. 设置others仓库

git remote add others https://others.git

2. 合并others仓库master分支的代码

git pull others
git checkout master
git merge --allow-unrelated-histories others/master
git push

3. 合并others仓库的tag

git pull others
git checkout master
git merge others/tag1.xx
git push
0  赞