Skip to content
GitmoapAPIBeta
Reviewmerge-requests
POST/repositories/{repo_id}/merge-requests/{mr_id}/conflicts/resolve

Resolve a merge request's conflicts

resolve_mr_conflicts
  • commit:create
    A token needs the commit:create scope: Write commits from file changes, and resolve merge-request conflictsGranted by write_api, write_repository.Every operation this scope unlocks
  • Audited · mutation

    x-gitmoap-audit: {"kind":"audited","arg":"mutation"}

  • Quota · namespace storage

    x-gitmoap-quota: {"kind":"enforced","arg":"namespace_storage"}

  • Dry run
    Takes dry_run.

One merge commit on the merge request's branch — the target merged into it, each conflicted file replaced by its resolution: content written in the browser, one side's version, or the file deleted. It lands through the same branch rules and push rules as a push to that branch, so the merge request moves, its pipelines run and its approvals behave as after one. dry_run=true says what resolving would do and writes nothing.

Parameters

Path
  • repo_idRepositoryId (string · uuid)Repository ID
  • mr_idMergeRequestId (integer · int64)Merge request ID
Query
  • dry_runbooleanoptionalSay what resolving would do — every refusal, the pipelines it would start — and write nothing

Request body

application/json
  • filesarray of ConflictResolutionOne resolution per conflicted file, and none for a file that is not.
    • The ConflictResolution schema
    • actionResolutionActionwriteuse_sourceuse_targetdeleteHow one conflicted file is resolved.
    • pathFilePath (string)
    • contentstring or nulloptionalThe file's resolved content, for write.
    • encodingBlobEncodingutf8base64optional
  • source_shaCommitHash (string)The merge request's branch head the resolution was made against.
  • target_shaCommitHash (string)The target branch head the resolution was made against.
  • messageCommitMessage (string) or nulloptionalThe merge commit's message. Defaults to Merge branch '<target>' into '<source>'.
Request body exampleSynthesized example
{
"files": [
{
"action": "write",
"path": "path-5dd2"
},
{
"action": "write",
"path": "path-614e"
}
],
"source_sha": "cc0e5a7a5f736ca386a0e985074412f202892d8c",
"target_sha": "47d2e8bfd495cf7d55b5cf389b1804aae5e1b022"
}

Responses

200A preview: what resolving would do. Nothing was writtenapplication/json
  • allowedboolean
  • pipelinesarray of PredictedPipelineThe pipelines the merge commit would start on the merge request's branch.
    • The PredictedPipeline schema
    • namestring
    • pipeline_idPipelineId (string · uuid) or nulloptionalThe pipeline, when it is one stored in the platform. A pipeline declared in a file under .gitmoap/pipelines/ has no id and is named by its file.
  • refusalsarray of Refusal
    • The Refusal schema
    • codeRefusalCodePERMISSION_REQUIREDBRANCH_PROTECTEDAGENT_REFFOREIGN_AUTHORPRIVILEGED_PATHBRANCH_NOT_FOUNDSTART_BRANCH_NOT_FOUNDFILE_NOT_FOUNDREPOSITORY_EMPTYMR_NOT_OPENNOT_CONFLICTEDHEAD_MOVEDBRANCH_EXISTSFILE_CHANGEDFILE_EXISTSPATH_CONFLICTUNSUPPORTED_ENTRYNOTHING_TO_COMMITUNRESOLVEDNOT_IN_CONFLICTUNSUPPORTED_CONFLICTPUSH_RULE_VIOLATIONWhat kind of refusal this is. Closed: a client branches on it. The wire spelling is the SCREAMING_SNAKE domain code that leads an error's message, so a refusal returned as data and the same refusal returned as an error read the same.
    • messagestringWhat is wrong, in a sentence a person can act on.
    • fieldstring or nulloptionalThe part of the request the refusal is about: message, branch, or actions[i] for the i-th file change.
    • rulestring or nulloptionalThe push rule that refused, by its setting's name (require_issue_reference), when code is PUSH_RULE_VIOLATION.
200 exampleSynthesized example
{
"allowed": false,
"pipelines": [
{
"name": "payments-api"
}
],
"refusals": [
{
"code": "PERMISSION_REQUIRED",
"message": "Inline scalar newtypes but keep their brand"
}
]
}
201The merge commit landed on the merge request's branchapplication/json
  • commitCommitThe merge commit on the merge request's branch.
    • The Commit schema
    • author_emailEmail (string)
    • author_namestring
    • authored_atstring
    • commit_shaCommitHash (string)
    • committed_atstring
    • committer_emailEmail (string)
    • committer_namestring
    • repository_idRepositoryId (string · uuid)
    • short_shaShortCommitHash (string)
    • titlestring
    • author_avatar_urlstring or nulloptional
    • committer_avatar_urlstring or nulloptional
    • messagestring or nulloptional
    • parent_shasarray of CommitHash (string)optional
    • tagsarray of TagName (string)optional
  • merge_requestMergeRequestThe merge request, now proposing the merge commit.
    • The MergeRequest schema
    • created_atstring
    • created_byPrincipalId (string · uuid)The person or agent who opened it.
    • is_draftboolean
    • merge_request_idMergeRequestId (integer · int64)
    • repository_idRepositoryId (string · uuid)
    • source_branchBranchName (string)
    • source_branch_deletedboolean
    • source_branch_headCommitHash (string)
    • statusMergeRequestStatusopenmergedclosed
    • target_branchBranchName (string)
    • target_branch_headCommitHash (string)
    • titleMrTitle (string)
    • updated_atstring
    • author_can_pushboolean or nulloptionalWhether the author can push to the repository — false for a drive-by contributor's merge request. Absent where it was not computed.
    • closed_atstring or nulloptional
    • closed_byPrincipalId (string · uuid) or nulloptional
    • descriptionMrDescription (string) or nulloptional
    • merge_commit_shaCommitHash (string) or nulloptional
    • merged_atstring or nulloptional
    • merged_byPrincipalId (string · uuid) or nulloptional
    • restack_requiredbooleanoptionalPrecise restack signal — set when this MR's downstack was squash-merged (a rebase is genuinely required to drop the duplicated diff). Distinct from the advisory commits_behind. Reset on the MR's next source-advancing write.
    • stack_summaryStackSummary or nulloptionalThe neighbouring merge requests in this stack. Returned when fetching a single merge request, not in listings.
      • The StackSummary schema
      • has_downstackboolean
      • has_upstackboolean
      • downstack_mr_idMergeRequestId (integer · int64) or nulloptional
      • upstack_mr_idsarray of MergeRequestId (integer · int64)optional
    • versioninteger · int64optional0–∞Optimistic-concurrency counter. Bumped on every write; writes condition on the read value.
201 exampleSynthesized example
{
"commit": {
"author_email": "tomas@acme.example",
"author_name": "Lin Park",
"authored_at": "2026-10-12T07:38:12Z",
"commit_sha": "921b87a1cfd0e2495e7e40eb14e4b002897c7c63",
"committed_at": "2026-10-13T09:50:01Z",
"committer_email": "mara@acme.example",
"committer_name": "payments-api",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70",
"short_sha": "edaaf6c07e049c4de31da3e1a3fa0a9024776210",
"title": "Pin a page's payload to the build that rendered it",
"author_avatar_url": "https://gitmoap.example/acme/a4fd6245",
"committer_avatar_url": "https://gitmoap.example/acme/18ded268",
"message": "Stream pipeline status into the run header",
"parent_shas": [
"7dc40fb8cbcf11c795006add02f7a86f9feb2f29"
],
"tags": [
"tags-dd25",
"tags-efb0"
]
},
"merge_request": {
"created_at": "2026-10-08T22:22:34Z",
"created_by": "c9d8e7f6-a5b4-4c3d-9e2f-1a0b9c8d7e6f",
"is_draft": false,
"merge_request_id": 42,
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70",
"source_branch": "feature/region-legend",
"source_branch_deleted": false,
"source_branch_head": "b2be470a8a9fa6f960a0f5d197781efc73aac5cc",
"status": "open",
"target_branch": "main",
"target_branch_head": "b6fd2f541b782b1d254eeaf11212b3af65eaebf6",
"title": "Label every synthesized example",
"updated_at": "2026-10-16T13:22:17Z",
"author_can_push": false,
"closed_at": "2026-10-09T12:49:24Z",
"closed_by": "c9d8e7f6-a5b4-4c3d-9e2f-1a0b9c8d7e6f",
"description": "Renders each region as density contours of its operations.",
"merge_commit_sha": "ad3864997997c16447383bc70bfed5130316a8b6",
"merged_at": "2026-10-10T07:16:35Z",
"merged_by": "b7e2d1c0-9f8e-4d7c-a6b5-c4d3e2f1a0b9",
"restack_required": false,
"stack_summary": {
"has_downstack": false,
"has_upstack": false,
"downstack_mr_id": 42,
"upstack_mr_ids": [
42
]
},
"version": 55
}
}
400Malformed request: a file resolved twice, a `write` without content, content on a side choice, content that is not valid base64application/json
Error codes
  • BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-5005",
"message": "Draw the region map from operation density"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
  • UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-f5e6",
"message": "Pin a page's payload to the build that rendered it"
}
}
403The caller may not push to the merge request's branch, or a branch rule protects itapplication/json
Error codes
  • BRANCH_PROTECTEDA branch rule keeps you from changing this branch this way
  • FORBIDDENYou are signed in but may not do this here; reason names the permission or the rule that refused it
  • INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs; required_scope names it
  • PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-ee97",
"message": "Stream pipeline status into the run header"
}
}
404Repository, merge request, or one of its branches not foundapplication/json
Error codes
  • BRANCH_NOT_FOUNDThe branch does not exist, and nothing asked for it to be created
  • NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-5923",
"message": "Stream pipeline status into the run header"
}
}
409A branch moved since the conflicts were read, the merge request is not open, or nothing conflictsapplication/json
Error codes
  • CONFLICTThe request conflicts with the resource's current state; reason says how
  • HEAD_MOVEDThe branch moved since you read it; read it again and retry
  • LEGAL_ACCEPTANCE_REQUIREDAccept the current Terms of Service before changing anything; reading stays open
  • MR_NOT_OPENThe merge request is merged or closed
  • NOT_CONFLICTEDThe merge request's branches merge cleanly; there is nothing to resolve
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
409 exampleSynthesized example
{
"error": {
"code": "code-438c",
"message": "Inline scalar newtypes but keep their brand"
}
}
413The request is larger than 16 MiBapplication/json
Error codes
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
413 exampleSynthesized example
{
"error": {
"code": "code-43c1",
"message": "Inline scalar newtypes but keep their brand"
}
}
422A conflicted file has no resolution, a resolution names a file that does not conflict, the conflict can only be resolved with git, or a push rule refuses the merge commitapplication/json
Error codes
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
422 exampleSynthesized example
{
"error": {
"code": "code-5f69",
"message": "Pin a page's payload to the build that rendered it"
}
}
429The merge commit would take the namespace over its storage limitapplication/json
Error codes
  • TOO_MANY_REQUESTSRetryableA quota, a rate limit or a transfer budget is spent. When the response carries Retry-After, retry after that many seconds
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
429 exampleSynthesized example
{
"error": {
"code": "code-aab7",
"message": "Inline scalar newtypes but keep their brand"
}
}

CLI

gitmoap mr resolve-conflicts

  • --repo-ididRepository ID (id or owner/repo path)
  • --mr-ididMerge request ID
  • --dry-runflagoptionalSay what resolving would do — every refusal, the pipelines it would start — and write nothing
  • --filesjsonOne resolution per conflicted file, and none for a file that is not.
  • --messagestringoptional
  • --source-shastringThe merge request's branch head the resolution was made against.
  • --target-shastringThe target branch head the resolution was made against.

Used in these guides