我该如何应用来自github的补丁?
我尝试编译Minisat,但使用clang编译时遇到了两个问题。
第一个问题在这个Github提交中得到解决,它是从原始github分叉出来的。由于更改很小,我可以手动修补代码以使其正常工作。
第二个问题在这个github (https://github.com/niklasso/minisat/pull/17)中得到解决,但是该补丁没有应用到原始源代码中。我可以通过复制修改后的文件来手动更新代码,但如果我能将此补丁拉入本地目录,那就更好了。是否可以使用github做到这一点?如果可以,应该怎么做呢?
https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch
下载文件并将其保存为“1.patch”,然后前往https://github.com/niklasso/minisat/pull/17.patch
下载文件并将其保存为“2.patch”。之后运行命令git apply --check 1.patch
和git apply --check 2.patch
查看是否有错误。如果没有错误,运行命令git apply 1.patch
和git apply 2.patch
对你的文件进行补丁更改。 - Serban Constantingit apply
也可以从标准输入读取。因此,可以在终端中发出以下命令:curl -sL -o - https://github.com/org/repo/pull/92.patch | git apply -
。 - bric3