Working with 2 git repos simultaneously

时间:2015-06-15 14:23:38

标签: git

My company purchased a license to certain software. The license includes access to the product's github account so we can get real-time updates by fetching code directly from the repository.

Additionally, we also develop new functionality for this software in-house, and for that we have created a new git account (cloned from the original) that has our version of the code.

What's the best way to merge the code from the product's original repo to our code? Currently the two repositories are configured as different remote repositories.

2 个答案:

答案 0 :(得分:3)

Assuming upstream is the name of the upstream remote and that you want to merge in its master branch, I think it should be as simple as:

#fetch upstream changes
git fetch upstream 

#go to the branch where you'll integrate them
git checkout your_development_branch

#merge in upstream changes
git merge upstream/master 

#push the result to your remote
git push origin your_development_branch

答案 1 :(得分:1)

一般来说,使用原始repo使用的不同引用名称。例如,如果他们分别使用masterdev使用mainnext。从那里开始,只需设置维护状态并不断从上游存储库中提取数据的服务。

根据您公司的需要,您可能希望或不希望合并来自上游源的代码。许多公司更愿意在将它们与自己的知识产权混合之前对他们提取的代码进行版权扫描。

一般建立拉原文,扫描内容,拒绝/解决版权问题,合并到摄取分支,合并摄取分支到开发分支等模式。