我正在尝试应用补丁,但 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/