Git 应用二进制文件差异。 "patch does not apply" 错误
Git apply binary file diff. "patch does not apply" error
我在 test_branch 中修改了一个二进制文件,然后,在另一个分支中做了:
git diff --full-index --binary test_branch binary_file_name.dat | git apply
但是,我收到以下错误:
error: the patch applies to 'binary_file_name.dat' (e4d7fc486a4ddd1638445449c5bfcec760b23c7f), which does not match the current contents.
error: binary_file_name.dat: patch does not apply
有谁知道如何修复错误并应用二进制差异?
git diff --full-index --binary test_branch binary_file_name.dat
等同于 git diff --full-index --binary test_branch HEAD binary_file_name.dat
。 diff 表示将 test_branch
的 binary_file_name.dat
更新为另一个分支 (HEAD
) 的 binary_file_name.dat
的更改。但是你现在在另一个分支上,这意味着当前 binary_file_name.dat
已经是更新版本了。因此,在 git diff
中交换 HEAD
和 test_branch
,它将按预期工作。
git diff --full-index --binary HEAD test_branch binary_file_name.dat | git apply
我在 test_branch 中修改了一个二进制文件,然后,在另一个分支中做了:
git diff --full-index --binary test_branch binary_file_name.dat | git apply
但是,我收到以下错误:
error: the patch applies to 'binary_file_name.dat' (e4d7fc486a4ddd1638445449c5bfcec760b23c7f), which does not match the current contents.
error: binary_file_name.dat: patch does not apply
有谁知道如何修复错误并应用二进制差异?
git diff --full-index --binary test_branch binary_file_name.dat
等同于 git diff --full-index --binary test_branch HEAD binary_file_name.dat
。 diff 表示将 test_branch
的 binary_file_name.dat
更新为另一个分支 (HEAD
) 的 binary_file_name.dat
的更改。但是你现在在另一个分支上,这意味着当前 binary_file_name.dat
已经是更新版本了。因此,在 git diff
中交换 HEAD
和 test_branch
,它将按预期工作。
git diff --full-index --binary HEAD test_branch binary_file_name.dat | git apply