简体   繁体   English

具有1个主存储库的多个git存储库

[英]Multiple git repositories with 1 main repository

I'm using my own admin panel for multiple websites. 我正在使用自己的管理面板访问多个网站。

I have a git repository for just the admin panel, and a seperate git repository for every website. 我有一个仅用于管理面板的git存储库,还有一个用于每个网站的单独的git存储库。

So my question is: How can I update my admin panel easily. 所以我的问题是:如何轻松更新管理面板。 When I commit something to the admin panel repository, how can I automatically merge the new feature into the websites that are using that admin panel. 当我向管理面板存储库中提交内容时,如何自动将新功能合并到使用该管理面板的网站中。

Do I need a plugin on my server for it or can I run some commands on the server every time something gets commited in the admin panel it merges with the other repositories. 我是否需要在服务器上使用插件,还是每次在管理面板中将某些内容与其他存储库合并时在服务器上运行一些命令?

You can use git submodules . 您可以使用git子模块

In every repository that depends on the admin panel repository, you should add a submodule. 在依赖于管理面板存储库的每个存储库中,都应添加一个子模块。 Say repo1 and repo2 depend on the admin panel. 说repo1和repo2取决于管理面板。

 cd repo1/
 git submodule add <admin_panel_repository_url>

And that's it. 就是这样。 If the admin panel repository has changed, you can update repo1 and repo2: 如果管理面板存储库已更改,则可以更新repo1和repo2:

cd repo1/
git submodule update

Hope that helps. 希望能有所帮助。

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

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