使用API更改GITHUB的默认分支.
问题描述:
我需要创建一个除master
分支以外的分支dev
.还需要使用GITHUB API将dev更新到默认分支.
I need to create a branch dev
which is other than master
branch. Also need to update dev to default branch using GITHUB API.
如果有人知道以编程方式调用哪个API或执行该API的方式,请分享详细信息.我了解在UI的帮助下我们可以做到.
Please share details if anyone know which API to call or a way to do it, programmatically. I understand with help of UI we can do it.
谢谢 灰烬
答
我没有足够的声誉来回答以上亚当的评论,但问题是名称是必填字段. JSON实际上应该是:
I don't have enough reputation to reply to the Adam's comment above but the problem is name is a required field. The JSON should actually be:
PATCH/repos/:owner/:repo { 名称"::回购" "default_branch":开发" }
PATCH /repos/:owner/:repo { "name":":repo" "default_branch": "dev" }