Git 应用补丁静默失败(没有错误但什么也没有发生)

标签 git patch msysgit

我正在尝试应用补丁,但 git apply patch 没有给我任何错误:

sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)
$ git apply ../../commit-d0d9477

sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)
$

如您所见,没有给出任何错误消息。但是当我打开历史记录时,什么都没有提交,索引是空的。就好像我没有发出 git apply 命令一样。

我不知道如何解决这个问题,因为 Google 没有错误。

编辑: 我忘了说了,但我正在尝试从 Tesseract 的存储库移植我的补丁,在那里我获得了没有版本控制的源代码,创建了我自己的空 git 存储库,并制作了一些 promise 。后来我使用 git svn 克隆了 Tesseract 存储库,现在我正尝试将我的补丁移到那里。

最佳答案

我在谷歌搜索问题时发现了这个:http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository

git apply will fail to do anything when used within a local checkout of a git repository (other than the one for the project the patch is made for), such as if you are patching a module that is within a site that is in Git version control.

Use patch -p1 < path/file.patch instead.

关于Git 应用补丁静默失败(没有错误但什么也没有发生),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24821431/

相关文章:

git - 配置本地分支以推送到特定分支

git - 我如何显示提交做了什么?

git - 如何在新的 pull 请求中排除旧的提交?

Git:重命名分支中的目录

Django Tastypie PATCH 抛出 "' Bundle' 对象不可迭代”错误

sitecore - 在 Sitecore 中修补 web.config

ubuntu - 使用 Ansible 和 apt,如何将 bash 更新为可远程利用的安全漏洞 CVE-2014-6271?

git-cat-文件输出

python - 检查repo是否脏时gitpython错误

Git Push 不要求输入密码并给出 401。在控制台中内联输入密码时很好