Commits - Get Commits

Retrieve git commits for a project

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?api-version=4.1
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?searchCriteria.historyMode={searchCriteria.historyMode}&searchCriteria.includeWorkItems={searchCriteria.includeWorkItems}&searchCriteria.includeLinks={searchCriteria.includeLinks}&searchCriteria.$top={searchCriteria.$top}&searchCriteria.$skip={searchCriteria.$skip}&searchCriteria.excludeDeletes={searchCriteria.excludeDeletes}&searchCriteria.itemPath={searchCriteria.itemPath}&searchCriteria.author={searchCriteria.author}&searchCriteria.user={searchCriteria.user}&searchCriteria.toCommitId={searchCriteria.toCommitId}&searchCriteria.fromCommitId={searchCriteria.fromCommitId}&searchCriteria.compareVersion.versionOptions={searchCriteria.compareVersion.versionOptions}&searchCriteria.compareVersion.version={searchCriteria.compareVersion.version}&searchCriteria.compareVersion.versionType={searchCriteria.compareVersion.versionType}&searchCriteria.itemVersion.versionOptions={searchCriteria.itemVersion.versionOptions}&searchCriteria.itemVersion.version={searchCriteria.itemVersion.version}&searchCriteria.itemVersion.versionType={searchCriteria.itemVersion.versionType}&searchCriteria.toDate={searchCriteria.toDate}&searchCriteria.fromDate={searchCriteria.fromDate}&searchCriteria.ids={searchCriteria.ids}&$skip={$skip}&$top={$top}&api-version=4.1

URI Parameters

Name In Required Type Description
organization
path True
  • string

The name of the Azure DevOps organization.

project
path
  • string

Project ID or project name

repositoryId
path True
  • string

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

$skip
query
  • integer
int32
searchCriteria.ids
query
  • array

If provided, specifies the exact commit ids of the commits to fetch. May not be combined with other parameters.

searchCriteria.fromDate
query
  • string

If provided, only include history entries created after this date (string)

searchCriteria.toDate
query
  • string

If provided, only include history entries created before this date (string)

searchCriteria.itemVersion.versionType
query

Version type (branch, tag, or commit). Determines how Id is interpreted

searchCriteria.itemVersion.version
query
  • string

Version string identifier (name of tag/branch, SHA1 of commit)

searchCriteria.itemVersion.versionOptions
query

Version options - Specify additional modifiers to version (e.g Previous)

searchCriteria.compareVersion.versionType
query

Version type (branch, tag, or commit). Determines how Id is interpreted

searchCriteria.compareVersion.version
query
  • string

Version string identifier (name of tag/branch, SHA1 of commit)

searchCriteria.compareVersion.versionOptions
query

Version options - Specify additional modifiers to version (e.g Previous)

searchCriteria.toCommitId
query
  • string

If provided, an upper bound for filtering commits alphabetically

$top
query
  • integer
int32
searchCriteria.user
query
  • string

Alias or display name of the committer

searchCriteria.author
query
  • string

Alias or display name of the author

searchCriteria.itemPath
query
  • string

Path of item to search under

searchCriteria.excludeDeletes
query
  • boolean

If true, don't include delete history entries

searchCriteria.$skip
query
  • integer
int32

Number of entries to skip

searchCriteria.$top
query
  • integer
int32

Maximum number of entries to retrieve

searchCriteria.includeLinks
query
  • boolean

Whether to include the _links field on the shallow references

searchCriteria.includeWorkItems
query
  • boolean

Whether to include linked work items

searchCriteria.historyMode
query

What Git history mode should be used. This only applies to the search criteria when Ids = null.

searchCriteria.fromCommitId
query
  • string

If provided, a lower bound for filtering commits alphabetically

api-version
query True
  • string

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

Responses

Name Type Description
200 OK

successful operation

Examples

All commits
By author
By committer
In a date range
On a branch
On a branch and in a path
Paging
Reachable from a commit
Reachable from a commit and path

All commits

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?api-version=4.1

Sample Response

{
  "count": 8,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "8921e81180bdf0e8b448be302698e425273e9df0",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "comment": "Merge pull request 1 from b1 into master",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/8921e81180bdf0e8b448be302698e425273e9df0",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/8921e81180bdf0e8b448be302698e425273e9df0"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

By author

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.author=Norman Paulk&api-version=4.1

Sample Response

{
  "count": 8,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "8921e81180bdf0e8b448be302698e425273e9df0",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "comment": "Merge pull request 1 from b1 into master",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/8921e81180bdf0e8b448be302698e425273e9df0",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/8921e81180bdf0e8b448be302698e425273e9df0"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

By committer

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.user=shsamy@microsoft.com&api-version=4.1

Sample Response

{
  "count": 8,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "8921e81180bdf0e8b448be302698e425273e9df0",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "comment": "Merge pull request 1 from b1 into master",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/8921e81180bdf0e8b448be302698e425273e9df0",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/8921e81180bdf0e8b448be302698e425273e9df0"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

In a date range

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.toDate=6/16/2018 12:00:00 AM&searchCriteria.fromDate=6/14/2018 12:00:00 AM&api-version=4.1

Sample Response

{
  "count": 8,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "8921e81180bdf0e8b448be302698e425273e9df0",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "comment": "Merge pull request 1 from b1 into master",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/8921e81180bdf0e8b448be302698e425273e9df0",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/8921e81180bdf0e8b448be302698e425273e9df0"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

On a branch

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.itemVersion.version=master&api-version=4.1

Sample Response

link: <9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7>;rel="startingCommitId"
{
  "count": 6,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

On a branch and in a path

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.itemPath=/debug.log&searchCriteria.itemVersion.version=master&api-version=4.1

Sample Response

link: <9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7>;rel="startingCommitId"
{
  "count": 1,
  "value": [
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "changes": [
        {
          "sourceServerItem": "/debug.log",
          "changeType": "add"
        }
      ],
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    }
  ]
}

Paging

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?$skip=1&$top=2&api-version=4.1

Sample Response

link: ;rel="next"
{
  "count": 2,
  "value": [
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    }
  ]
}

Reachable from a commit

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.compareVersion.version=4fa42e1a7b0215cc70cd4e927cb70c422123af84&searchCriteria.compareVersion.versionType=commit&api-version=4.1

Sample Response

{
  "count": 8,
  "value": [
    {
      "commitId": "9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:53Z"
      },
      "comment": "Merged PR 2: Deleted README.md",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9991b4f66def4c0a9ad8f9f27043ece7eddcf1c7"
    },
    {
      "commitId": "c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:38Z"
      },
      "comment": "Merge pull request 2 from b2 into master",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/c771e2e3605c69d2435a6b34b28ac3db2c89efd2",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/c771e2e3605c69d2435a6b34b28ac3db2c89efd2"
    },
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    },
    {
      "commitId": "4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:17Z"
      },
      "comment": "Merged PR 1: Added file debug.log",
      "commentTruncated": true,
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4bac640ecfd017eeadfd282a8e31bcd8ab6d132b"
    },
    {
      "commitId": "8921e81180bdf0e8b448be302698e425273e9df0",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:28Z"
      },
      "comment": "Merge pull request 1 from b1 into master",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/8921e81180bdf0e8b448be302698e425273e9df0",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/8921e81180bdf0e8b448be302698e425273e9df0"
    },
    {
      "commitId": "3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:05:18Z"
      },
      "comment": "Added file debug.log",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/3104bd0b0accbc74278fe6880e53215f6b93a5cd",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/3104bd0b0accbc74278fe6880e53215f6b93a5cd"
    },
    {
      "commitId": "9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:45Z"
      },
      "comment": "Added file file1.txt",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/9c1e8b082e2c2f041bdd5db76d6bf5c11572524f"
    },
    {
      "commitId": "4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:04:22Z"
      },
      "comment": "Added README.md file",
      "changeCounts": {
        "Add": 1,
        "Edit": 0,
        "Delete": 0
      },
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/4fa42e1a7b0215cc70cd4e927cb70c422123af84",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/4fa42e1a7b0215cc70cd4e927cb70c422123af84"
    }
  ]
}

Reachable from a commit and path

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/commits?searchCriteria.itemPath=/README.md&searchCriteria.compareVersion.version=master&searchCriteria.itemVersion.version=4fa42e1a7b0215cc70cd4e927cb70c422123af84&searchCriteria.itemVersion.versionType=commit&api-version=4.1

Sample Response

link: <4fa42e1a7b0215cc70cd4e927cb70c422123af84>;rel="startingCommitId"
{
  "count": 1,
  "value": [
    {
      "commitId": "20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "author": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "committer": {
        "name": "Norman Paulk",
        "email": "Fabrikamfiber16@hotmail.com",
        "date": "2018-06-15T17:06:32Z"
      },
      "comment": "Deleted README.md",
      "changeCounts": {
        "Add": 0,
        "Edit": 0,
        "Delete": 1
      },
      "changes": [
        {
          "sourceServerItem": "/README.md",
          "changeType": "delete"
        }
      ],
      "url": "https://dev.azure.com/fabrikam/1fec3816-a6f6-4d90-97eb-3bc4630ac416/_apis/git/repositories/1701bc47-1145-4739-a805-64b02e40dbe7/commits/20510720ffe1443d6ed3cb98ca340bc732ba04e5",
      "remoteUrl": "https://dev.azure.com/fabrikam/SomeGitProject/_git/SampleRepository/commit/20510720ffe1443d6ed3cb98ca340bc732ba04e5"
    }
  ]
}

Definitions

ChangeCountDictionary
GitChange
GitCommitRef

Provides properties that describe a Git commit and associated metadata.

GitHistoryMode

What Git history mode should be used. This only applies to the search criteria when Ids = null.

GitStatus

This class contains the metadata of a service/extension posting a status.

GitStatusContext

Status context that uniquely identifies the status.

GitStatusState

State of the status.

GitTemplate
GitUserDate

User info and date for Git operations.

GitVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

GitVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted

IdentityRef
ItemContent
ItemContentType
ReferenceLinks

The class to represent a collection of REST reference links.

ResourceRef
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

The type of change that was made to the item.

item
  • string

Current version.

newContent

Content of the item after the change.

newContentTemplate

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.

GitCommitRef

Provides properties that describe a Git commit and associated metadata.

Name Type Description
_links

A collection of related REST reference links.

author

Author of the commit.

changeCounts

Counts of the types of changes (edits, deletes, etc.) included with the commit.

changes

An enumeration of the changes included with the commit.

comment
  • string

Comment or message of the commit.

commentTruncated
  • boolean

Indicates if the comment is truncated from the full Git commit comment message.

commitId
  • string

ID (SHA-1) of the commit.

committer

Committer of the commit.

parents
  • string[]

An enumeration of the parent commit IDs for this commit.

remoteUrl
  • string

Remote URL path to the commit.

statuses

A list of status metadata from services and extensions that may associate additional information to the commit.

url
  • string

REST URL for this resource.

workItems

A list of workitems associated with this commit.

GitHistoryMode

What Git history mode should be used. This only applies to the search criteria when Ids = null.

Name Type Description
firstParent
  • string

The history mode used by git log --first-parent

fullHistory
  • string

The history mode used by git log --full-history

fullHistorySimplifyMerges
  • string

The history mode used by git log --full-history --simplify-merges

simplifiedHistory
  • string

The history mode used by git log. This is the default.

GitStatus

This class contains the metadata of a service/extension posting a status.

Name Type Description
_links

Reference links.

context

Context of the status.

createdBy

Identity that created the status.

creationDate
  • string

Creation date and time of the status.

description
  • string

Status description. Typically describes current state of the status.

id
  • integer

Status identifier.

state

State of the status.

targetUrl
  • string

URL with status details.

updatedDate
  • string

Last update date and time of the status.

GitStatusContext

Status context that uniquely identifies the status.

Name Type Description
genre
  • string

Genre of the status. Typically name of the service/tool generating the status, can be empty.

name
  • string

Name identifier of the status, cannot be null or empty.

GitStatusState

State of the status.

Name Type Description
error
  • string

Status with an error.

failed
  • string

Status failed.

notApplicable
  • string

Status is not applicable to the target object.

notSet
  • string

Status state not set. Default state.

pending
  • string

Status pending.

succeeded
  • string

Status succeeded.

GitTemplate

Name Type Description
name
  • string

Name of the Template

type
  • string

Type of the Template

GitUserDate

User info and date for Git operations.

Name Type Description
date
  • string

Date of the Git operation.

email
  • string

Email address of the user performing the Git operation.

name
  • string

Name of the user performing the Git operation.

GitVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

Name Type Description
firstParent
  • string

First parent of commit (HEAD^)

none
  • string

Not specified

previousChange
  • string

Commit that changed item prior to the current version

GitVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted

Name Type Description
branch
  • string

Interpret the version as a branch name

commit
  • string

Interpret the version as a commit ID (SHA1)

tag
  • string

Interpret the version as a tag name

IdentityRef

Name Type Description
_links

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor
  • string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias
  • string
displayName
  • string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id
  • string
imageUrl
  • string
inactive
  • boolean
isAadIdentity
  • boolean
isContainer
  • boolean
profileUrl
  • string
uniqueName
  • string
url
  • string

This url is the full route to the source resource of this graph subject.

ItemContent

Name Type Description
content
  • string
contentType

ItemContentType

Name Type Description
base64Encoded
  • string
rawText
  • string

The class to represent a collection of REST reference links.

Name Type Description
links
  • object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

ResourceRef

Name Type Description
id
  • string
url
  • 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