我们可以在 GIT 中合并不同项目的 2 个分支吗?

Can we merge 2 brances of different projects in GIT

我正在尝试理解不相关历史的合并。 Git 'merge' 命令有一个选项“--allow-unmatched histories”来合并不相关的历史。我在这里缺少一些清晰度。 GIT 中的根文件夹名为 'project'。项目包含许多存储库。每个 repo 可能有多个分支。

考虑到这一切。我有两个 'projects' (a, b)。在项目 'a' 中,我有一个名为 'arepo' 的回购协议。 'arepo' 有一个分支 'abranch'。同样,还有项目'b'。项目 'b' 有一个名为 'brepo' 的回购协议。 'brepo' 有一个名为 'bbranch' 的分支。

下图描述了情况:-

在这种情况下,我们可以使用 GIT 合并的 "allow-unrelated-histories" 选项合并 "abranch" 和 "bbranch" 吗?

提前致谢。

来自 here 它说:

--allow-unrelated-histories By default, git merge command refuses to merge histories that do not share a common ancestor. This option can be used to override this safety when merging histories of two projects that started their lives independently. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.

所以看起来可以使用 --allow-unrelated-histories 选项合并不相关的历史记录。