# Merge a pull request

Merge an open pull request from the merge button at the bottom of its
**Conversation** tab. You need permission to merge, and the repository's
[rulesets](https://staging.git.cafe/docs/repositories/repository-rulesets.md) must be satisfied.

## Choose a merge method

Open the merge button's menu and choose one of:

- **Merge**: adds a merge commit that joins the two branches.
- **Squash and merge**: combines every commit into one commit on the target.
- **Rebase and merge**: replays each commit onto the target without a merge
  commit.

Methods the repository does not allow are marked unavailable. For a
repository synchronized with GitHub, GitHub performs the merge.

From the terminal, run `cafe pr merge <number> --strategy squash` (`merge`,
`squash`, `rebase` or `fast-forward`; the default is `merge`). Check readiness
first with `cafe pr ready <number>`. Members of a [stack](https://staging.git.cafe/docs/pull-requests/stacks.md) merge through the stack
with `cafe stack merge`.

## Fix what blocks a merge

When something stands in the way, the merge area shows **N blockers** or
**Conflicts**. Open it to see each requirement: required reviews, required
checks, conflicts or missing permissions. Resolve them and try again.

If the latest commits from a fork have not arrived yet, choose **Retry**.

## Delete the branch after merging

When **Automatically delete head branches** is on in the repository's
[settings](https://staging.git.cafe/docs/repositories/repository-settings.md), GitCafe deletes the source
branch after a merge. Default, target and protected branches, and branches used
by another open pull request, are kept. A deleted branch can be
[restored](https://staging.git.cafe/docs/repositories/repository-settings.md#restore-a-deleted-branch).

## Close, reopen or mark as draft

The merge button's menu also offers **Close pull request** and **Convert to
draft**. A draft pull request shows **Ready for review** instead of merge
options. Closed pull requests can be reopened; merged ones stay **Merged**.

## Merges made outside GitCafe

If the pull request's latest commit reaches the default branch another way,
such as a direct push, GitCafe marks the pull request **Merged**. Only that
exact commit counts: if you squashed or rebased the change before pushing,
close the pull request yourself.

To close issues when a change merges, see
[close issues from commits](https://staging.git.cafe/docs/issues/issues.md#close-issues-from-commits-and-pull-requests).
