# Merging a pull request

The «Merge pull request» button merges the branch into the target; linked issues close, the event goes into the feed, and the branch can be deleted.

> **Who can use this:** Merging requires write access to the repository.

## Merge

1. Make sure the state is «open — can be merged». If the branches conflict, SKILLOK shows the files
   changed on both sides: reconcile them in the pull request branch and push a new commit.
2. Press **Merge pull request** and confirm.

The pull request becomes **Merged**, a merge commit appears in the target branch, the issues from
«Closes #…» close, and the feed shows the merge event.

## Merge methods

The same three as on GitHub, chosen next to the **Merge** button (the last choice is remembered):

- **Create a merge commit.** All branch commits go into the target plus a merge commit with
  two parents. If the target has not moved, the branch is fast-forwarded without an extra commit.
- **Squash and merge.** All branch changes land as one commit titled "Pull request title (#12)",
  with the branch commit messages listed in the body. The branch history is not kept.
- **Rebase and merge.** Branch commits are replayed one by one on top of the target: a linear
  history, no merge commit, each commit keeps its author. A branch with merge commits cannot be
  rebased — use merge or squash.

Any method refuses on a conflict and lists the files changed on both sides. In the API the
method is the `merge_method` field: `merge`, `squash` or `rebase`.

## Close without merging

If the change is not needed, close the pull request with the close button — the branch stays, the
commits go nowhere. A closed pull request can be reopened.

## After the merge

The pull request branch can be deleted on the branches page; if it is already merged, there is no
warning about losing commits. Locally — `git switch main && git pull`.

---

https://skillok.org/docs/en/issues-and-pulls/pull-requests/merging-a-pull-request
