简体   繁体   English

链接两个 github repos

[英]Link two github repos

I want to make an opensource project.我想做一个开源项目。 I also have private parts of the app I thought in making 2 github repos and link them togther one is public and has the base code and the other one is private and dependent on the first.我也有我想在制作 2 github 存储库并将它们链接在一起的应用程序的私有部分,一个是公共的并且具有基本代码,另一个是私有的并且依赖于第一个。

I also want the dependent one to update as soon as I commit a change to the open source repo and define which parts of the project to be updated automatically我还希望依赖项在我对开源存储库进行更改并定义要自动更新的项目的哪些部分后立即更新

Is there a better alternate to my idea?我的想法有更好的替代方案吗? How could I achieve such result?我怎么能达到这样的结果?

Repo 2 depends on Repo 1, so you should have Repo 1 setup as a submodule in Repo 2. Repo 2 依赖于 Repo 1,因此您应该将 Repo 1 设置为 Repo 2 中的子模块

I don't know if you can set behaviors to pull the changes to Repo 1 immediately, but it'd be something like:我不知道您是否可以设置行为以立即将更改拉到 Repo 1,但它会是这样的:

cd ~/path/to/repo2
git submodule add https://url/to/repo1
git submodule update --init --recursive

Any time Repo 1 makes changes, you can任何时候 Repo 1 进行更改,您都可以

git pull

and then update the submodules然后更新子模块

git submodule update --init --recursive

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM