应用github commit/pull请求作为补丁 [英] Apply github commit / pull request as a patch

查看:129
本文介绍了应用github commit/pull请求作为补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从github应用补丁?

How can I apply the patch from github?

我尝试编译 minisat ,但是在使用clang进行编译时遇到了两个问题.

I tried to compile minisat, but I came across two issues from the compilation with clang.

第一个问题已在此github提交中解决,它是从原始github派生的.由于更改很小,我可以轻松地修补代码以手动工作.

The first issue is solved in this github commit, it's forked from the original github. As the change is minute, I could easily patched the code to work manually.

第二个问题已在此github中解决( https://github.com/niklasso/minisat/pull/17 ),但该补丁未应用于原始来源.我可以通过复制修改后的文件来手动更新代码,但是如果可以将此修补程序拉入本地目录,则更好.有可能用github做到这一点吗?如果是这样,该怎么做?

The second issue is solved in this github (https://github.com/niklasso/minisat/pull/17), but the patch is not applied to the original source. I could manually update the code by copying the modified files, but it would be better if I can pull this patch into my local directory. Is it possible to do that with github? If so, how to do it?

推荐答案

github为单个提交和请求请求提供了补丁(尽管我找不到有关此文件的文档).

github provides patches for individual commits and pull requests (though I can't find the documentation for this).

您可以通过简单地将.patch附加到原始URL的末尾来生成补丁URL.

You can generate the patch url by simply appending .patch to the end of the original url.

因此,请使用 https://github.com/JWalker1995/minisat/commit/a8cef9d9325522 .patch 首先, 和 https://github.com/niklasso/minisat/pull/17.patch第二个.

So, use https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch for the first, and https://github.com/niklasso/minisat/pull/17.patch for the second.

通用网址github.com/original/url/id将变为github.com/original/url/id.patch以便生成补丁.

The general url github.com/original/url/id would become github.com/original/url/id.patch for generating the patch.

根据要运行的命令,它变为

In terms of commands to run, this becomes

  1. 将补丁下载到您的git repo

  1. Download the patches to your git repo

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

  • 应用补丁

  • Apply the patches

    git apply issue1.patch
    

    检查更改,添加并提交.对补丁2重复相同的操作.

    Check the changes, add and commit. Repeat the same for patch 2.

    您可以检查这篇博客文章中提供了有关创建和应用补丁的不错的教程.

    You can check this blog post for a nice tutorial around creating and applying patches.

    这篇关于应用github commit/pull请求作为补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆