如何在git 2.9之前将无关历史合并到git中(--允许无关历史不可用)

如何在git 2.9之前将无关历史合并到git中(--允许无关历史不可用),git,git-merge,Git,Git Merge,我知道有一个选项——允许不相关的历史记录,它从Git 2.9开始就可以合并不相关的历史记录。然而,由于一些遗留的公司原因,我一直使用较旧版本的Git1.8 任何人都可以帮助演示如何在没有的情况下执行此操作--允许不相关的历史记录?如果这两个分支的历史记录中有自然缝合在一起的点(例如:提交相同的内容),您可以使用git replace(但我不知道它是否已经存在于1.8中?)或移植来缝合历史: # say <commit-a> on branch 'other' should be tr

我知道有一个选项
——允许不相关的历史记录
,它从Git 2.9开始就可以合并不相关的历史记录。然而,由于一些遗留的公司原因,我一直使用较旧版本的Git1.8


任何人都可以帮助演示如何在没有
的情况下执行此操作--允许不相关的历史记录

如果这两个分支的历史记录中有自然缝合在一起的点(例如:提交相同的内容),您可以使用
git replace
(但我不知道它是否已经存在于1.8中?)或移植来缝合历史:

# say <commit-a> on branch 'other' should be treated as
# <commit-b> on branch 'mine' :
git replace <commit-a> <commit-b>

# if 'git replace' does not exist :
# find the *descendant* of commit-a (say : child-a) and run :
echo "<child-a> <commit-b>" >> .git/info/grafts

# <child-a> is now treated as if <commit-b> was one of his parents

使用
1.8
合并两个不相关的历史记录是否会失败?否。但我一直得到错误
而不是我们可以合并的东西,这在使用Git 2.9时是不存在的。我遵循Yep的步骤,问题是我需要通过Jenkins作业定期自动同步两个回购。Jenkins构建代理拥有一个旧Git:(不,我不使用
git filter repo
。我遵循的命令是
cd path/to/project-b;
git merge--allow不相关的历史记录project-a/master;
我误解了您遵循的方式我删除了我的(无用的)评论。
git diff <commit with empty content> other > other.patch
git apply other.patch