MergeMergeRequest

Updated at:

Merges a specified merge request.

Operation description

This operation applies only to organizations that use the new merge request interface. To verify which interface you are using, check the Merge Request page in the Alibaba Cloud DevOps console.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /api/v4/projects/{repositoryId}/merge_requests/{localId}/merge HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

repositoryId

integer

Yes

The ID of the repository.

2709413

localId

integer

Yes

The local ID of the merge request. This ID is unique within a repository.

1

Request parameters

Parameter

Type

Required

Description

Example

organizationId

string

Yes

The ID of your organization. To get this ID, log in to the Alibaba Cloud DevOps console and copy it from your browser's address bar. For example, in the URL https://devops.aliyun.com/organization/{organizationId}, {organizationId} is the organization ID.

60de7a6852743a5162b5f957

accessToken

string

No

The personal access token. This parameter is not required if you use an Alibaba Cloud AK/SK or STS temporary authorization for authentication.

0cf2c8458ac44d9481aab2dd6ec10596v3

body

object

No

The request body.

mergeType

string

Yes

The merge type. Valid values:

  • no-fast-forward: Creates a merge commit, even if a fast-forward merge is possible. This is the default value.

  • squash: Squashes all commits from the source branch into a single commit on the target branch.

  • rebase: Rebases the commits from the source branch onto the target branch.

  • ff-only: The merge is accepted only if it can be resolved as a fast-forward.

no-fast-forward

mergeMessage

string

No

The message for the merge commit.

""

removeSourceBranch

boolean

No

Specifies whether to delete the source branch after a successful merge.

true

Response elements

Element

Type

Description

Example

object

The response schema.

requestId

string

The request ID.

9ED5E382-3A58-51E4-8A81-CE25D1756025

errorMessage

string

The error message.

""

errorCode

string

The error code.

SYSTEM_UNKNOWN_ERROR

success

boolean

Indicates whether the request was successful.

true

result

object

The result of the operation.

result

boolean

Indicates if the merge was successful.

true

mergedRevision

string

The commit SHA of the merged revision.

1a072f5367c21f9de3464b8c0ee8546e47764d2d

bizId

string

The business ID of the merge request.

bca90244c4b749e0b109df52ac0eb570

projectId

integer

The ID of the repository.

2369234

localId

integer

The local ID of the merge request. This ID is unique within a repository.

2

Examples

Success response

JSON format

{
  "requestId": "9ED5E382-3A58-51E4-8A81-CE25D1756025",
  "errorMessage": "\"\"",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "success": true,
  "result": {
    "result": true,
    "mergedRevision": "1a072f5367c21f9de3464b8c0ee8546e47764d2d",
    "bizId": "bca90244c4b749e0b109df52ac0eb570",
    "projectId": 2369234,
    "localId": 2
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.