Commits对比
GET/api/v5/repos/:owner/:repo/compare/:base...:head
Request
Path Parameters
owner stringrequired
仓库所属空间地址(企业、组织或个人的地址path)
repo stringrequired
仓库路径(path)
base stringrequired
对比的起点。Commit SHA、分支名或标签名
head stringrequired
对比的终点。Commit SHA、分支名或标签名
Query Parameters
access_token string
用户授权码
straight boolean
是否直对比。默认 false
suffix string
按照文件后缀过滤文件,如 .txt。只影响 files
Responses
- 200
成功响应
Response Headers
- application/json
- Schema
- Example (auto)
- Example
Schema
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
base_commit object
urlstring
shastring
html_urlstring
comments_urlstring
commit object
author object
namestring
datestring
emailstring
committer object
namestring
datestring
emailstring
tree object
shastring
urlstring
messagestring
author object
namestring
idinteger
loginstring
typestring
committer object
namestring
idinteger
loginstring
typestring
parents object[]
shastring
urlstring
merge_base_commit object
urlstring
shastring
html_urlstring
comments_urlstring
commit object
author object
namestring
datestring
emailstring
committer object
namestring
datestring
emailstring
tree object
shastring
urlstring
messagestring
author object
namestring
idinteger
loginstring
typestring
committer object
namestring
idinteger
loginstring
typestring
parents object[]
shastring
urlstring
commits object[]
shastring
commit object
author object
namestring
datestring
emailstring
committer object
namestring
datestring
emailstring
messagestring
author object
namestring
idinteger
loginstring
committer object
namestring
idinteger
loginstring
files object[]
shastring
filenamestring
statusstring
additionsinteger
deletionsinteger
changesinteger
blob_urlstring
raw_urlstring
patchstring
truncatedinteger
truncatedinteger
{
"base_commit": {
"url": "string",
"sha": "string",
"html_url": "string",
"comments_url": "string",
"commit": {
"author": {
"name": "string",
"date": "string",
"email": "string"
},
"committer": {
"name": "string",
"date": "string",
"email": "string"
},
"tree": {
"sha": "string",
"url": "string"
},
"message": "string"
},
"author": {
"name": "string",
"id": 0,
"login": "string",
"type": "string"
},
"committer": {
"name": "string",
"id": 0,
"login": "string",
"type": "string"
},
"parents": [
{
"sha": "string",
"url": "string"
}
]
},
"merge_base_commit": {
"url": "string",
"sha": "string",
"html_url": "string",
"comments_url": "string",
"commit": {
"author": {
"name": "string",
"date": "string",
"email": "string"
},
"committer": {
"name": "string",
"date": "string",
"email": "string"
},
"tree": {
"sha": "string",
"url": "string"
},
"message": "string"
},
"author": {
"name": "string",
"id": 0,
"login": "string",
"type": "string"
},
"committer": {
"name": "string",
"id": 0,
"login": "string",
"type": "string"
},
"parents": [
{
"sha": "string",
"url": "string"
}
]
},
"commits": [
{
"sha": "string",
"commit": {
"author": {
"name": "string",
"date": "string",
"email": "string"
},
"committer": {
"name": "string",
"date": "string",
"email": "string"
},
"message": "string"
},
"author": {
"name": "string",
"id": 0,
"login": "string"
},
"committer": {
"name": "string",
"id": 0,
"login": "string"
}
}
],
"files": [
{
"sha": "string",
"filename": "string",
"status": "string",
"additions": 0,
"deletions": 0,
"changes": 0,
"blob_url": "string",
"raw_url": "string",
"patch": "string",
"truncated": 0
}
],
"truncated": 0
}
{
"base_commit": {
"url": "https://api.gitcode.com/api/v5/repos/owner-test/secure-issue/commits/17922544024484084e2b6218eb0d46d76f354ffa",
"sha": "17922544024484084e2b6218eb0d46d76f354ffa",
"html_url": "https://test.gitcode.net/owner-test/secure-issue/commit/17922544024484084e2b6218eb0d46d76f354ffa",
"comments_url": "https://test.gitcode.net/api/v5/repos/owner-test/secure-issue/commits/17922544024484084e2b6218eb0d46d76f354ffa/comments",
"commit": {
"author": {
"name": "malongge5",
"date": "2024-08-13T11:34:35Z",
"email": "malongge5@noreply.gitcode.com"
},
"committer": {
"name": "malongge5",
"date": "2024-08-13T11:34:35Z",
"email": "malongge5@noreply.gitcode.com"
},
"tree": {
"sha": "4e12f62b7fe2f78cb7c1b088e8f7e797a8c898a3",
"url": "https://api.gitcode.com/repos/owner-test/secure-issue/git/trees/4e12f62b7fe2f78cb7c1b088e8f7e797a8c898a3"
},
"message": "new: 新增文件 test.py \n "
},
"author": {
"name": "malongge5",
"id": 953,
"login": "malongge5",
"type": "User"
},
"committer": {
"name": "malongge5",
"id": 953,
"login": "malongge5",
"type": "User"
},
"parents": [
{
"sha": "7ea40eef5f96c3f263f17438b294a6ea9b771cc5",
"url": "https://api.gitcode.com/api/v5/repos/owner-test/secure-issue/commits/7ea40eef5f96c3f263f17438b294a6ea9b771cc5"
}
]
},
"merge_base_commit": {
"url": "https://api.gitcode.com/api/v5/repos/owner-test/secure-issue/commits/17922544024484084e2b6218eb0d46d76f354ffa",
"sha": "17922544024484084e2b6218eb0d46d76f354ffa",
"html_url": "https://test.gitcode.net/owner-test/secure-issue/commit/17922544024484084e2b6218eb0d46d76f354ffa",
"comments_url": "https://test.gitcode.net/api/v5/repos/owner-test/secure-issue/commits/17922544024484084e2b6218eb0d46d76f354ffa/comments",
"commit": {
"author": {
"name": "malongge5",
"date": "2024-08-13T11:34:35Z",
"email": "malongge5@noreply.gitcode.com"
},
"committer": {
"name": "malongge5",
"date": "2024-08-13T11:34:35Z",
"email": "malongge5@noreply.gitcode.com"
},
"tree": {
"sha": "4e12f62b7fe2f78cb7c1b088e8f7e797a8c898a3",
"url": "https://api.gitcode.com/repos/owner-test/secure-issue/git/trees/4e12f62b7fe2f78cb7c1b088e8f7e797a8c898a3"
},
"message": "new: 新增文件 test.py \n "
},
"author": {
"name": "malongge5",
"id": 953,
"login": "malongge5",
"type": "User"
},
"committer": {
"name": "malongge5",
"id": 953,
"login": "malongge5",
"type": "User"
},
"parents": [
{
"sha": "7ea40eef5f96c3f263f17438b294a6ea9b771cc5",
"url": "https://api.gitcode.com/api/v5/repos/owner-test/secure-issue/commits/7ea40eef5f96c3f263f17438b294a6ea9b771cc5"
}
]
},
"commits": [
{
"sha": "97fd5a05e18bcd5b633a279fd7d395784d272321",
"commit": {
"author": {
"name": "malongge5",
"date": "2024-09-09T07:29:23Z",
"email": "malongge5@noreply.gitcode.com"
},
"committer": {
"name": "malongge5",
"date": "2024-09-09T07:29:23Z",
"email": "malongge5@noreply.gitcode.com"
},
"message": "new: 新增文件 bbb.rs \n "
},
"author": {
"name": "malongge5",
"id": 953,
"login": "malongge5"
},
"committer": {
"name": "malongge5",
"id": 953,
"login": "malongge5"
}
}
],
"files": [
{
"sha": "6533e5c4585eb91faa9331b8de6b22f9ff31d387",
"filename": "bbb.rs",
"status": "added",
"additions": 3,
"deletions": 0,
"changes": 3,
"blob_url": "https://test.gitcode.net/owner-test/secure-issue/blob/6533e5c4585eb91faa9331b8de6b22f9ff31d387/bbb.rs",
"raw_url": "https://test.gitcode.net/owner-test/secure-issue/raw/6533e5c4585eb91faa9331b8de6b22f9ff31d387/bbb.rs",
"patch": "@@ -0,0 +1,3 @@\n+\n+\n+println!(\"hello\")\n\\ No newline at end of file\n",
"truncated": false
}
],
"truncated": false
}