简体   繁体   English

如何将应用程序中的每个组件保留在单独的版本控制存储库中?

[英]How to keep each component from an application in a separate version control repository?

I want to keep each component of an application in a separate, independant repository, with its own versioning, so they can be distributed separately (eg: you may want to use only one or two components) 我想将应用程序的每个组件都保留在一个单独的,独立的存储库中,并具有自己的版本控制,以便可以分别分发它们(例如:您可能只想使用一个或两个组件)

Is there a standard way to do this with mercurial or git? 是否有标准的方法可以使用mercurir或git?

I have seen something like this in symfony2, all the bundles are separate and they get updated from their respective remote repositories with a single command. 我在symfony2中看到过类似的内容,所有捆绑包都是单独的,并且可以使用单个命令从各自的远程存储库中进行更新。

And what about nested repositories? 嵌套存储库又如何呢? Is that possible? 那可能吗?

With git you should have a submodule for each component. 使用git,您应该为每个组件都有一个子模块。

Then, from the different applications you want to distribute you just use the correct version from each submodule you need. 然后,从您要分发的不同应用程序中,仅使用所需子模块中的正确版本。

This is a very generic question, you can see more about submodules and how you can use them in your setup at: http://book.git-scm.com/5_submodules.html 这是一个非常笼统的问题,您可以在以下位置查看有关子模块以及如何在设置中使用它们的更多信息: http : //book.git-scm.com/5_submodules.html

With Mercurial, you are looking for Subrepos (also see the wiki link). 使用Mercurial,您正在寻找Subrepos (另请参阅Wiki链接)。

Each component may be a stand-alone Mercurial repo. 每个组件可以是独立的Mercurial回购。 These components can then be nested inside a "parent" repo as a subrepo. 然后,可以将这些组件作为子仓库嵌套在“父”仓库中。

The parent repo points to a specific revision of each subrepo, so different projects may use different versions. 父仓库指向每个子仓库的特定修订版,因此不同的项目可能使用不同的版本。

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

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