简体   繁体   English

使用git管理多个项目

[英]Managing multiple projects with git

I have multiple modules in a project say module1, module2, module3. 我在一个项目中有多个模块,例如module1,module2,module3。 Each project has multiple branches with structure as 每个项目都有多个分支,其结构如下

project |branch1 . module1|branch1 . module2 |branch1  .  module3|
        |branch2 .        |        .         |branch2  .         |
        |branch3 .        |branch3 .         |         .         |
        |branch4 .        |        .         |branch4  .         | branch4

Project contains a list of modules to take in but the catch is, if those aren't on same branch, the code breaks. Project包含要接受的模块列表,但要注意的是,如果这些模块不在同一分支上,则代码会中断。

For eg: I can keep the project on branch 1 and will need module1 and module2 on branch1, i don't care about module3 then. 例如:我可以将项目保留在分支1上,而在分支1上需要module1和module2,那么我不在乎module3。

PS: I cannot keep modules with project as projects and modules are developed by different teams and merging is done by another team for proper testing of code. PS:我无法将模块与项目保持在一起,因为项目和模块是由不同的团队开发的,并且合并是由另一个团队完成的,以便对代码进行适当的测试。 Also, changing of project or module before might lead to breaking. 另外,在此之前更改项目或模块可能会导致中断。

PPS: Right now, We manually change branches. PPS:现在,我们手动更改分支。 A visual way will be helpful as there a lot of branches. 视觉方式会很有帮助,因为那里有很多分支。

I cannot keep modules with project as projects and modules are developed by different teams and merging is done by another team for proper testing of code 我无法将模块与项目保持在一起,因为项目和模块是由不同的团队开发的,并且合并是由另一个团队完成的,以便对代码进行正确的测试

That other team can maintain a global Git repository reprenting your project and the modules checked out at their relevant commit, using git submodules 其他团队可以使用git子模块维护一个全局的Git存储库,以在您的项目和相关提交中检出您的项目和模块

In each branch of the main project, you can checkout any module you want to any branch you want, allowing for each branch of the main project to reference only the modules needed, and only at the references needed. 在主项目的每个分支中,可以将所需的任何模块签出到所需的任何分支,从而允许主项目的每个分支仅引用所需的模块,并且仅引用所需的引用。

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

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