简体   繁体   中英

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.

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 .

In every repository that depends on the admin panel repository, you should add a submodule. Say repo1 and repo2 depend on the admin panel.

 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:

cd repo1/
git submodule update

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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