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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.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 Api从上游合并_Github - Fatal编程技术网

使用GitHub Api从上游合并

使用GitHub Api从上游合并,github,Github,看起来我无法使用github api合并来自上游回购的提交: 我希望base参数是其他人的fork的分支。我试着用base作为“otheruser/master”和“otheruser:master”进行发布。在这个端点上没有办法跨分支合并吗?据我所知,mergeapi只支持在同一存储库中合并分支 我想你想提出拉车请求。 必须在存储库中/从中发出请求,更改将被拉入。在您的例子中,端点看起来像这样 /repos/:owner/:repo/pulls :所有者将是其他用户 :repo将是他们分支

看起来我无法使用github api合并来自上游回购的提交:


我希望
base
参数是其他人的fork的分支。我试着用base作为“
otheruser/master
”和“
otheruser:master
”进行发布。在这个端点上没有办法跨分支合并吗?

据我所知,mergeapi只支持在同一存储库中合并分支

我想你想提出拉车请求。

必须在
存储库中/从中发出请求,更改将被拉入。在您的例子中,端点看起来像这样

/repos/:owner/:repo/pulls

:所有者将是
其他用户

:repo
将是他们分支的名称


如文档中所述,这是一篇
POST
。在正文中,您可以将分支指定为
,如下所示
base
应该只是分支的名称。
base
只需要是分支的名称,因为拉取请求是在具有
base
分支的存储库中发出的。

解决方案是使用
refs

请求如下所示:

https://api.github.com/repos/<fork-owner>/<fork-repo>/git/refs/heads/<forked-branch-name>
{
  "sha": <master-sha-in-origin-repo>,
  "force": true
}
https://api.github.com/repos///git/refs/heads/
身体看起来像这样:

https://api.github.com/repos/<fork-owner>/<fork-repo>/git/refs/heads/<forked-branch-name>
{
  "sha": <master-sha-in-origin-repo>,
  "force": true
}
{
“sha”:,
“力量”:真实
}

小心


如果在fork和原始文件之间有一个Pull请求打开,它将关闭PR并运行提交

在这种情况下,生成PR如何帮助我?从fork到我的repo存在一个PR-aleady,我想使用GithubApi用master更新fork的代码库