文档

创建分支

更新时间:

该接口用于创建分支

请求方式POST/api/v3/projects/[ProjectId]/repository/branches

请求Action:CreateBranch

请求参数:

参数名

类型

说明

是否必须

默认值

ProjectId

long

代码库id

请求 body

{
  "branch_name": "string",
  "ref": "string"
}

body参数说明

参数名

类型

说明

是否必须

默认值

branch_name

string

分支名称

ref

string

分支创建的来源,可以为分支名称、标签名称或提交版本

返回 body :

{
   "ErrorCode": "",
   "ErrorMessage": "",
   "RequestId": "",
   "Success":true,
   "Result": {
  "BranchName": "",
  "ProtectedBranch": false,
  "CommitInfo": {
   "Id": "b022b4518194d8078c825990fd878838dafdaab2",
   "ShortId": "b022b451",
   "Title": "Delete file kq4wg8f1_new",
   "AuthorName": "xxxxxx",
   "AuthorEmail": "xxxxxxx@xxx.com",
   "CreatedAt": "2020-09-04T11:44:42+08:00",
   "Message": "Delete file kq4wg8f1_new",
   "AuthorDate": "2020-09-04T11:44:42+08:00",
   "CommittedDate": "2020-09-04T11:44:42+08:00",
   "CommitterEmail": "xxxxxxx@xxx.com",
   "CommitterName": "xxxxxxx",
   "ParentIds": [
    "36f089ea679a45adaac5c882e2c19d2b2f96308e"
   ]
  }
    }
}

返回结果说明:

参数名

类型

说明

BranchName

string

分支名称

ProtectedBranch

boolean

保护分支

CommitInfo

struct

分支最近一次提交信息

CommitInfo结构:

参数名

类型

说明

Id

string

commit SHA

ShortId

string

短id

Title

string

标题,提交的第一行内容

AuthorName

string

作者姓名

AuthorEmail

string

作者邮箱

CreatedAt

string

创建时间

Message

string

提交内容

AuthorDate

string

作者提交时间

CommittedDate

string

提交者提交时间

CommitterEmail

string

提交者邮箱

CommitterName

string

提交者姓名

ParentIds

list

父提交id

  • 本页导读 (0)