简体   繁体   English

将多个项目合并到一个解决方案中,同时保留 git 历史记录

[英]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):

  • "A" solution “一个解法
  • Database Library Solution*数据库库解决方案*
  • Wix Installer Solution Wix 安装程序解决方案
  • Wix Bundle Solution Wix 捆绑解决方案

Project B (repo B):项目 B(回购 B):

  • "B" Solution “B”解决方案
  • Database Library Solution*数据库库解决方案*
  • Wix Installer Solution Wix 安装程序解决方案
  • Wix Bundle Solution Wix 捆绑解决方案

*(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:主项目:

  • Solution A解决方案 A
    • Wix Installer and Bundle for A适用于 A 的 Wix 安装程序和捆绑包
  • Solution B解决方案 B
    • Wix Installer and Bundle for B Wix B 的安装程序和捆绑包
  • Database Library Solution数据库库解决方案

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

You can read about git submodules here您可以在此处阅读有关 git 子模块的信息

暂无
暂无

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

相关问题 合并git仓库并保存历史 - Merging git repositories and preserving history 将许多小型项目合并为一个多项目,同时保留Git的历史和分支 - Merging many small projects into one multi-project while keeping history and branches in Git 在将许多git仓库合并到一个保存其历史记录的同时发生绑定错误 - binding error while merging many git repository into one preserving their histories 将多个目录从一个git项目移动到另一个git项目,保留其历史记录 - Moving multiple directories from one git project to another, preserving their history Git,如何在不使用子模块的情况下合并多个保存历史的项目 - Git, how to combine multiple projects preserving history, without using sub-modules Git:将多个存储库合并到一个目录中以保持历史记录时发生冲突 - Git: Conflicts merging multiple repositories into one directory keeping the history 在保留历史记录的同时恢复git目录 - Restoring git directory while preserving history git 合并多个副本保留历史 - git merge multiple copies preserving history 使用GIT在一个解决方案中的VisualStudio 2012中的多个项目 - Multiple Projects in VisualStudio 2012 in one Solution using GIT 是否可以将一堆文件从一个git存储库移动到另一个git存储库,同时保留(大多数)历史记录? - Is it possible to move a bunch of files from one git repository to another while preserving (most) history?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM