我有一个Git diff创建
git diff --full-index --ignore-submodules > mypatch.diff
Run Code Online (Sandbox Code Playgroud)
当试图将它应用于另一个git repo(同一个远程分支,更高级的修订版)时,我在标题中得到错误
git apply --3way mypatch.diff
...
error: patch failed: dir/file:189
error: repository lacks the necessary blob to fall back on 3-way merge.
error: dir/file: patch does not apply
Run Code Online (Sandbox Code Playgroud)
多个文件会发生这种情况.
https://git-scm.com/docs/git-apply状态下的文档
当补丁不能干净地应用时,如果补丁记录了应该应用的blob的身份,则回退到三向合并,并且我们在本地可以使用这些blob,可能会将冲突标记留在工作树中的文件中供用户解决.
在我的情况下,有趣的是文件(Git术语中的blob)位于目标存储库中(甚至没有重命名),因此必须通过"git apply"找到它们.
注意:过去,命令序列已经工作了好几次.
git ×1