[英]Merging multiple projects into one solution while preserving git history
I have multiple projects (solutions) each have a separate git repo setup.我有多个项目(解决方案),每个项目都有一个单独的 git 存储库设置。
I intend to merge the projects into a single solution to simplify build and distribution since all projects the same database solution.我打算将项目合并到一个解决方案中以简化构建和分发,因为所有项目都是相同的数据库解决方案。 architecture is as follows
架构如下
Project A (repo A):项目 A(回购 A):
Project B (repo B):项目 B(回购 B):
*(the Database Library Solution is exactly the same in both projects, but with each change to it we need to copy paste the changes to the other project) *(数据库库解决方案在两个项目中完全相同,但每次更改时我们都需要将更改复制粘贴到另一个项目)
To simplify and unify the development environment I'd like to make it as following:为了简化和统一开发环境,我想如下:
Master Project:主项目:
How do I achieve this result by unifying the project into a single solution that has a brand new git repo, while preserving Solution A and B git history?如何通过将项目统一到具有全新 git 存储库的单个解决方案中来实现此结果,同时保留解决方案 A 和 B git 历史记录?
You can use git submodules to achieve this.您可以使用 git 子模块来实现此目的。 Create the master git repo and add the required git repos and git submodules by adding a.gitmodules file like:
创建主 git 存储库并通过添加 a.gitmodules 文件添加所需的 git 存储库和 git 子模块,例如:
[submodule "module1"]
path = /path/module1
url = https://github.com/user/module1
[submodule "module2"]
path = /path/module2
url = https://github.com/user/module2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.