git - 获取错误消息 '' 致命 : sha1 information is lacking or useless"when apply a patch using "git am -3"

标签 git

我正在尝试使用 git am -3 “补丁路径”将一系列补丁从一个 git 存储库应用到另一个 git 存储库。我按顺序应用它们,从补丁 1-4 开始,效果很好。

但是当我来到第 5 个补丁时,我收到错误提示“fatal: sha1 information is lacked or useless”。我转到应用补丁的 git 存储库,我确实看到了文件“dev/afile”。 所以我想知道为什么 git 会提示“缺少或无用的 sha1 信息 (dev/afile.c)”,我该如何解决我的问题?

 $ git am -3 ~/Tmp/mypatches/0005-fifth.patch
Applying: rpmsg: Allow devices to use custom buffer allocator
fatal: sha1 information is lacking or useless (dev/afile.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 first patch
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

为什么它说“补丁在 0001 第一个补丁失败”,当我执行“git am -3 ~/Tmp/mypatches/0005-fifth.patch”时,它完成且没有错误。

谢谢。

最佳答案

只需执行以下操作即可解决此问题:

patch -p1 < example.patch

关于git - 获取错误消息 '' 致命 : sha1 information is lacking or useless"when apply a patch using "git am -3",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32557855/

相关文章:

git - 将 Git Diff 限制为一项或多项功能?

git - merge 冲突解决

git - git-log 和 git-whatchanged 之间的区别?

Github:与另一个组织共享私有(private)存储库

Git:必须分发但忽略/不重新上传的文件?

GitLab SSH key 停止工作

git - 致命 : bad config file line in . 为删除 merge 分支创建别名时的 gitconfig 文件

ruby-on-rails - 无法在 Windows 上运行 bundle 更新

android - 无法初始化 Git 团队提供程序

git - git merge origin branchname 有什么作用?