创建一个项目分支
POST
/api/v1/{owner}/{repo}/branches.json最后修改时间: 1 年前
请求参数
Path 参数
owner
string
必需
repo
string
必需
Query 参数
debug
string
可选
示例值:
admin
Header 参数
Cookie
string
可选
Body 参数application/json
new_branch_name
string
新分支名称
old_branch_name
string
从哪个分支创建
示例
{
"new_branch_name": "string",
"old_branch_name": "string"
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
total_count
integer
必需
branches
array [object {12}]
必需
name
string
分支名称
commit
object
分支最后一个commit
protected
boolean
是否为保护分支
user_can_push
boolean
当前用户是否能推送代码
user_can_merge
boolean
当前用户是否能合并代码
commit_id
null
commit sha
commit_time_from_now
string
commit提交时间(距离现在)
commit_time
null
commit提交时间
default_branch
null
默认分支
http_url
string
http clone地址
zip_url
string
zip文件下载地址
tar_url
string
tar文件下载地址
示例成功示例
{
"name": "new_branch_8",
"commit": {
"id": "80dd40214a58622312393b2ae693756a4781fab2",
"message": "x拟增\n\nSigned-off-by: yystopf <yystopf@163.com>",
"author": {
"id": "2",
"login": "yystopf",
"name": "heh",
"type": "User",
"image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
},
"committer": {
"id": "2",
"login": "yystopf",
"name": "heh",
"type": "User",
"image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
},
"time_ago": "1天前",
"timestamp": "2022-07-13T09:54:15Z"
},
"protected": false,
"user_can_push": true,
"user_can_merge": true,
"commit_id": "80dd40214a58622312393b2ae693756a4781fab2",
"commit_time_from_now": "1天前",
"commit_time": "2022-07-13T09:54:15Z",
"default_branch": "master",
"http_url": "http://127.0.0.1:10081/yystopf/ceshi_hook.git",
"zip_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.zip",
"tar_url": "http://localhost:3000/api/yystopf/ceshi_hook/archive/new_branch_8.tar.gz"
}
最后修改时间: 1 年前