Commits - Get Changes

检索特定提交的更改。

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?top={top}&skip={skip}&api-version=7.1

URI 参数

名称 必需 类型 说明
commitId
path True

string

提交的 ID。

organization
path True

string

Azure DevOps 组织的名称。

repositoryId
path True

string

存储库的 ID 或友好名称。 若要使用友好名称,还必须指定 projectId。

project
path

string

项目 ID 或项目名称

api-version
query True

string

要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。

skip
query

integer (int32)

要跳过的更改数。

top
query

integer (int32)

要返回的最大更改数。

响应

名称 类型 说明
200 OK

GitCommitChanges

成功作

安全性

oauth2

类型: oauth2
流向: accessCode
授权 URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
令牌 URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

作用域

名称 说明
vso.code 授予读取有关提交、更改集、分支和其他版本控制项目的源代码和元数据的能力。 此外,还可以通过服务挂钩搜索代码并获取有关版本控制事件的通知。

示例

With changes

示例请求

GET https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4/changes?top=2&skip=10&api-version=7.1

示例响应

{
  "changeCounts": {
    "Add": 456
  },
  "changes": [
    {
      "item": {
        "gitObjectType": "blob",
        "path": "/MyWebSite/MyWebSite/favicon.ico",
        "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items/MyWebSite/MyWebSite/favicon.ico?versionType=Commit"
      },
      "changeType": "add"
    },
    {
      "item": {
        "gitObjectType": "tree",
        "path": "/MyWebSite/MyWebSite/fonts",
        "isFolder": true,
        "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items/MyWebSite/MyWebSite/fonts?versionType=Commit"
      },
      "changeType": "add"
    }
  ]
}

定义

名称 说明
ChangeCountDictionary
GitChange
GitCommitChanges
GitTemplate
ItemContent
ItemContentType
VersionControlChangeType

对项所做的更改的类型。

ChangeCountDictionary

GitChange

名称 类型 说明
changeId

integer (int32)

更改组中更改的 ID。

changeType

VersionControlChangeType

对项所做的更改的类型。

item

string (T)

当前版本。

newContent

ItemContent

更改后项的内容。

newContentTemplate

GitTemplate

推送新更改时要使用的新内容模板。

originalPath

string

项目的原始路径(如果与当前路径不同)。

sourceServerItem

string

服务器上的项的路径。

url

string

用于检索项的 URL。

GitCommitChanges

名称 类型 说明
changeCounts

ChangeCountDictionary

changes

GitChange[]

GitTemplate

名称 类型 说明
name

string

模板的名称

type

string

模板的类型

ItemContent

名称 类型 说明
content

string

contentType

ItemContentType

ItemContentType

说明
base64Encoded
rawText

VersionControlChangeType

对项所做的更改的类型。

说明
add
all
branch
delete
edit
encoding
lock
merge
none
property
rename
rollback
sourceRename
targetRename
undelete