# merge\_forge\_pull\_request

Merge a pull request on its forge, by the method and with the message asked for.

writes · not idempotent · destructive · CLI only · [Forge](https://komrad.dev/latest/api/forge.md)

Without a method, the forge merges by one the base branch allows, and without a message it writes its own.

## Calling it

```bash
curl -X POST http://127.0.0.1:8787/komrad.forge.v1.ForgeService/MergeForgePullRequest \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "<url>"
}'
```

```bash
komrad rpc merge-forge-pull-request \
  --url '<string>'
```

## Request

### MergeForgePullRequestRequest

| Field | Type | Description |
| --- | --- | --- |
| [`url`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeForgePullRequestRequest-url) | string\* at most 2048 characters | The pull request to merge, by web address. The address's host picks the forge connection. |
| [`method`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeForgePullRequestRequest-method) | [MergeMethod](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeMethod) | How the pull request merges. Unspecified merges by a method the base branch allows. |
| [`headline`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeForgePullRequestRequest-headline) | string not empty at most 1024 characters | The first line of the commit the merge writes. Unset leaves it to the forge. |
| [`body`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeForgePullRequestRequest-body) | string at most 65536 characters | The rest of the commit the merge writes. Unset leaves it to the forge, and empty writes a headline alone. |
| [`head_sha`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeForgePullRequestRequest-head_sha) | string at most 64 characters | The head commit the caller expects. The forge refuses to merge once the branch has moved past it. Empty accepts any head. |

## Response

### Empty

No fields.

## Types

### MergeMethod

MergeMethod is how a pull request's commits land on its base branch.

| Value | Description |
| --- | --- |
| [`merge`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeMethod-merge) | The commits land under a merge commit. |
| [`squash`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeMethod-squash) | The commits land as one new commit. |
| [`rebase`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeMethod-rebase) | The commits are replayed onto the base branch one by one. |
| [`fast_forward`](https://komrad.dev/latest/api/forge/merge-forge-pull-request.md#komrad-forge-v1-MergeMethod-fast_forward) | The base branch moves to the head commit, without a commit of its own. |
