# Open a pull request

A pull request proposes merging the commits on one branch (the source) into
another (the target). Open one when your branch is ready for review, then
[review](https://staging.git.cafe/docs/pull-requests/review.md) and [merge](https://staging.git.cafe/docs/pull-requests/merge.md) it.

## Open a pull request in the browser

1. Push your branch (see [Git access](https://staging.git.cafe/docs/getting-started/git-access.md)).
2. Open the repository's **Pull requests** tab and choose **New Pull Request**.
   From the **Branches** tab, **New pull request** on a branch row preselects
   that branch as the source.
3. Pick the **Source branch** and the **Target branch**. The target defaults to
   the repository's default branch.
4. Enter a **Title** (prefilled from the branch name: `fix-parser` becomes
   `Fix parser`) and an optional **Description**. The description supports
   Markdown and pasted or dropped images.
5. Choose **Create Pull Request**.

The diff between the two branches appears under the form so you can check what
you are proposing. If creation fails, the error appears above the button and
the form keeps your values.

## Open a pull request from a fork

On a fork, turn on **Create pull request on upstream `owner/repo`**. The target
picker then lists the parent repository's branches, and the pull request is
created in the parent with your fork's branch as its source. Cross-fork pull
requests have no diff preview on the form. The toggle is unavailable while the
description contains an attached image, because attachments belong to the
repository they were uploaded to.

## Open a pull request from the CLI

From a checkout of the repository, with your branch pushed:

```sh
cafe pr create --title "Fix the parser" --body-file description.md
```

The source is the current branch and the target is the default branch unless
you pass `--head` or `--base`. See the
[CLI reference](https://staging.git.cafe/docs/reference/cli.md#pull-requests) for the other commands.

## Change the target branch

To retarget an open pull request, run:

```sh
cafe pr edit 27 --base main
```

You need permission to edit the pull request, and the new target must already
exist. Members of a [stack](https://staging.git.cafe/docs/pull-requests/stacks.md) follow their stack instead, and pull
requests in a repository synchronized with GitHub change their base on GitHub.

## Find a pull request

The **Pull requests** tab starts with **Status is Open**. Change that filter to
find merged or closed pull requests, or remove it to see every status.

- **Add filter** narrows by assignee, creator, label, milestone, source or
  target branch, cross-fork status, or whether the discussion is locked. Each
  filter supports **is** and **is not**.
- **Search** matches titles within your active filters.
- The address keeps your search and filters, so you can bookmark or share the
  view.

Results are newest first; **Load more** shows older ones. If a pull request is
missing, clear the search and check the status filter.
