Commits - Get Changes
擷取特定認可的變更。
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?api-version=5.0
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?top={top}&skip={skip}&api-version=5.0
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
commit
|
path | True |
string |
認可的識別碼。 |
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
repository
|
path | True |
string |
存放庫的識別碼或易記名稱。 若要使用易記名稱,也必須指定 projectId。 |
|
project
|
path |
string |
專案識別碼或專案名稱 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 '5.0' 以使用此版本的 API。 |
|
skip
|
query |
integer int32 |
要略過的變更數目。 |
|
|
top
|
query |
integer int32 |
要傳回的變更數目上限。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功的作業 |
安全性
oauth2
類型:
oauth2
Flow:
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
範圍
| 名稱 | Description |
|---|---|
| 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=5.0
範例回覆
{
"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"
}
]
}
定義
| 名稱 | Description |
|---|---|
|
Change |
|
|
Git |
|
|
Git |
|
|
Git |
|
|
Item |
|
|
Item |
|
|
Version |
對專案所做的變更類型。 |
ChangeCountDictionary
GitChange
| 名稱 | 類型 | Description |
|---|---|---|
| changeId |
integer |
變更群組內的變更識別碼。 |
| changeType |
對專案所做的變更類型。 |
|
| item |
string |
目前版本。 |
| newContent |
變更之後的專案內容。 |
|
| newContentTemplate |
推送新變更時要使用的新內容範本。 |
|
| originalPath |
string |
與目前路徑不同的專案原始路徑。 |
| sourceServerItem |
string |
伺服器上的專案路徑。 |
| url |
string |
要擷取專案的 URL。 |
GitCommitChanges
| 名稱 | 類型 | Description |
|---|---|---|
| changeCounts | ||
| changes |
GitTemplate
| 名稱 | 類型 | Description |
|---|---|---|
| name |
string |
範本的名稱 |
| type |
string |
範本的類型 |
ItemContent
| 名稱 | 類型 | Description |
|---|---|---|
| content |
string |
|
| contentType |
ItemContentType
| 值 | Description |
|---|---|
| base64Encoded | |
| rawText |
VersionControlChangeType
對專案所做的變更類型。
| 值 | Description |
|---|---|
| add | |
| all | |
| branch | |
| delete | |
| edit | |
| encoding | |
| lock | |
| merge | |
| none | |
| property | |
| rename | |
| rollback | |
| sourceRename | |
| targetRename | |
| undelete |