简体   繁体   中英

git-how to maintain multiple repositories inside one repository

Probably this can be solved using submodules , but I don't know how in this case.

I am thinking of this hierarchy:

web-app-repo/
   .git
   README.md
   fontend-repo/
      .git
      README.md
   backend-repo/
      .git
      README.md

The web-app-repo is a remote one. The other two repos are local ones. If possible, how can I do this?

I need to be able to make updates on my machine and push commits to their respective remote repos.

Yes, the way to go is using submodules, but you should publish the submodules if you want to include them in a published project.

When you have some submodule in a project what you have is simple a "pointer" to the commit that identifies your submodule status.

If you make changes in some of your submodules and you commit those changes to your project this pointer will be updated to track the new status of your submodule.

When you or some of your team do a "submodule update" git simply loads your submodule in the status of that commit. If the submodule is not published the users of your project will not be able to update the submodules in that commit and git will give you an error.

If you don't want the code of your submodules to be public probably you need to convert your submodules in packages.

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