Commits - Get Changes

检索特定提交的更改。

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?api-version=6.1-preview.1
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?top={top}&skip={skip}&api-version=6.1-preview.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 版本。 这应设置为“6.1-preview.1”才能使用此版本的 API。

skip
query

integer

int32

要跳过的更改数。

top
query

integer

int32

要返回的最大更改数。

响应

名称 类型 说明
200 OK

GitCommitChanges

成功的操作

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token 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

Scopes

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

示例

With changes

Sample Request

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

Sample Response

{
  "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

更改组中更改的 ID。

changeType

VersionControlChangeType

对项所做的更改的类型。

item

string

当前版本。

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

string

rawText

string

VersionControlChangeType

对项所做的更改的类型。

名称 类型 说明
add

string

all

string

branch

string

delete

string

edit

string

encoding

string

lock

string

merge

string

none

string

property

string

rename

string

rollback

string

sourceRename

string

targetRename

string

undelete

string