如何应用 github 上的补丁?
我尝试编译minisat https://github.com/niklasso/minisat,但是我在用 clang 编译时遇到了两个问题。
第一个问题已解决这个 github 提交 https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235,它是从原始 github 分叉出来的。由于更改很小,我可以轻松地修补代码以手动工作。
第二个问题在这个github中解决了(https://github.com/niklasso/minisat/pull/17 https://github.com/niklasso/minisat/pull/17),但补丁未应用于原始源。我可以通过复制修改的文件来手动更新代码,但如果我可以将此补丁拉到本地目录中会更好。可以用github来做吗?如果可以的话,该怎么办呢?
github 提供了针对单独提交和拉取请求的补丁(尽管我找不到这方面的文档)。
您可以通过简单地附加来生成补丁 url.patch
到原始网址的末尾。
So, use https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch为了第一,
和https://github.com/niklasso/minisat/pull/17.patch https://github.com/niklasso/minisat/pull/17.patch对于第二个。
通用网址github.com/original/url/id
会成为github.com/original/url/id.patch
用于生成补丁。
就要运行的命令而言,这变成了
-
将补丁下载到您的 git 存储库
wget --output-document=issue1.patch https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch
wget --output-document=issue2.patch https://github.com/niklasso/minisat/pull/17.patch
-
应用补丁
git apply issue1.patch
检查更改、添加并提交。对补丁 2 重复相同的操作。
你可以检查这篇博文 https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/有关创建和应用补丁的精彩教程。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)