Commits - Get Changes

Retrieve changes for a particular commit.

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 Parameters

Name In Required Type Description
commitId
path True

string

The id of the commit.

organization
path True

string

The name of the Azure DevOps organization.

repositoryId
path True

string

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0' to use this version of the api.

skip
query

integer

int32

The number of changes to skip.

top
query

integer

int32

The maximum number of changes to return.

Responses

Name Type Description
200 OK

GitCommitChanges

successful operation

Security

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

Name Description
vso.code Grants the ability to read source code and metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to search code and get notified about version control events via service hooks.

Examples

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=5.0

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"
    }
  ]
}

Definitions

Name Description
ChangeCountDictionary
GitChange
GitCommitChanges
GitTemplate
ItemContent
ItemContentType
VersionControlChangeType

The type of change that was made to the item.

ChangeCountDictionary

GitChange

Name Type Description
changeId

integer

ID of the change within the group of changes.

changeType

VersionControlChangeType

The type of change that was made to the item.

item

string

Current version.

newContent

ItemContent

Content of the item after the change.

newContentTemplate

GitTemplate

New Content template to be used when pushing new changes.

originalPath

string

Original path of item if different from current path.

sourceServerItem

string

Path of the item on the server.

url

string

URL to retrieve the item.

GitCommitChanges

Name Type Description
changeCounts

ChangeCountDictionary

changes

GitChange[]

GitTemplate

Name Type Description
name

string

Name of the Template

type

string

Type of the Template

ItemContent

Name Type Description
content

string

contentType

ItemContentType

ItemContentType

Name Type Description
base64Encoded

string

rawText

string

VersionControlChangeType

The type of change that was made to the item.

Name Type Description
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