Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将github提交/拉取请求作为修补程序应用_Git_Github_Pull Request_Git Patch - Fatal编程技术网

将github提交/拉取请求作为修补程序应用

将github提交/拉取请求作为修补程序应用,git,github,pull-request,git-patch,Git,Github,Pull Request,Git Patch,如何从github应用修补程序 我试图编译,但在使用clang编译时遇到了两个问题 第一个问题在中解决,它是从最初的github派生出来的。由于更改很小,我可以轻松地修补代码以手动工作 第二个问题在这个github()中得到了解决,但是补丁没有应用于原始源代码。我可以通过复制修改过的文件来手动更新代码,但是如果我能将这个补丁拉到我的本地目录中会更好。使用github可以做到这一点吗?如果是这样,怎么做?您可以分叉项目并将第二个添加为第二个远程, 然后可以将所需的分支合并到项目中 git远程添加

如何从github应用修补程序

我试图编译,但在使用clang编译时遇到了两个问题

第一个问题在中解决,它是从最初的github派生出来的。由于更改很小,我可以轻松地修补代码以手动工作


第二个问题在这个github()中得到了解决,但是补丁没有应用于原始源代码。我可以通过复制修改过的文件来手动更新代码,但是如果我能将这个补丁拉到我的本地目录中会更好。使用github可以做到这一点吗?如果是这样,怎么做?

您可以分叉项目并将第二个添加为第二个远程, 然后可以将所需的分支合并到项目中


git远程添加remote2git@github.com:niklasso/miniat.git
GitFetchRemote2
git合并remote2主机

然后更新的代码将合并到您的项目中。
一旦拉请求应用于原始repo(合并拉请求),您将不会看到任何更改,因为您的副本中已经有提交id。

github为单个提交和拉请求提供了修补程序(尽管我找不到相关文档)

只需将
.patch
附加到原始url的末尾,即可生成修补程序url

因此,第一次使用, 第二个

通用url
github.com/original/url/id
将成为生成补丁的
github.com/original/url/id.patch

就要运行的命令而言,这将成为

  • 将补丁下载到您的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
    
  • 应用补丁

    git apply issue1.patch
    
    检查更改、添加和提交。对修补程序2重复相同的操作


  • 您可以查看有关创建和应用修补程序的详细教程。

    @prosseek,转到
    https://github.com/JWalker1995/minisat/commit/a8cef9d932552b2ec155d5e0d44d8fe0efa3a235.patch
    并将内容另存为
    1.patch
    ,然后转到
    https://github.com/niklasso/minisat/pull/17.patch
    并将内容另存为
    2.patch
    。然后运行
    git-apply——检查1.patch
    git-apply——检查2.patch
    。如果在运行
    git apply 1.patch
    然后运行
    git apply 2.patch
    时没有收到任何错误,请使用更改对文件进行修补。