Merges - Create
Request a git merge operation. Currently we support merging only 2 commits.
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryNameOrId}/merges?api-version=7.1
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryNameOrId}/merges?includeLinks={includeLinks}&api-version=7.1
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
The name of the Azure DevOps organization. |
|
project
|
path | True |
string |
Project ID or project name |
|
repository
|
path | True |
string |
The name or ID of the repository. |
|
api-version
|
query | True |
string |
Version of the API to use. This should be set to '7.1' to use this version of the api. |
|
include
|
query |
boolean |
True to include links |
Request Body
| Name | Type | Description |
|---|---|---|
| comment |
string |
Comment or message of the commit. |
| parents |
string[] |
An enumeration of the parent commit IDs for the merge commit. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
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_manage | Grants the ability to read, update, and delete source code, access metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to create and manage code repositories, create and manage pull requests and code reviews, and to receive notifications about version control events via service hooks. |
Examples
Create a merge request.
Sample request
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryNameOrId}/merges?api-version=7.1
{
"parents": [
"638b0477e874c08482009a1ac6912b504e197ef1",
"7e7460f6b61bbaa7cc2b52e4c33c0fb44d65ef9a"
],
"comment": "Merge these commits for me!"
}
Sample response
{
"mergeOperationId": 2,
"status": "queued",
"detailedStatus": {},
"parents": [
"638b0477e874c08482009a1ac6912b504e197ef1",
"7e7460f6b61bbaa7cc2b52e4c33c0fb44d65ef9a"
],
"comment": "Merge these commits for me!"
}
Definitions
| Name | Description |
|---|---|
|
Git |
|
|
Git |
|
|
Git |
Status information about a requested merge operation. |
|
Git |
Parameters required for performing git merge. |
|
Reference |
The class to represent a collection of REST reference links. |
GitAsyncOperationStatus
| Value | Description |
|---|---|
| queued |
The operation is waiting in a queue and has not yet started. |
| inProgress |
The operation is currently in progress. |
| completed |
The operation has completed. |
| failed |
The operation has failed. Check for an error message. |
| abandoned |
The operation has been abandoned. |
GitMerge
| Name | Type | Description |
|---|---|---|
| _links |
Reference links. |
|
| comment |
string |
Comment or message of the commit. |
| detailedStatus |
Detailed status of the merge operation. |
|
| mergeOperationId |
integer (int32) |
Unique identifier for the merge operation. |
| parents |
string[] |
An enumeration of the parent commit IDs for the merge commit. |
| status |
Status of the merge operation. |
GitMergeOperationStatusDetail
Status information about a requested merge operation.
| Name | Type | Description |
|---|---|---|
| failureMessage |
string |
Error message if the operation failed. |
| mergeCommitId |
string |
The commitId of the resultant merge commit. |
GitMergeParameters
Parameters required for performing git merge.
| Name | Type | Description |
|---|---|---|
| comment |
string |
Comment or message of the commit. |
| parents |
string[] |
An enumeration of the parent commit IDs for the merge commit. |
ReferenceLinks
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. |