---
title: Preview Every Pull Request
url: "/learn/previews/"
canonical_url: https://docs.blossom88.com/learn/previews/
markdown_url: https://docs.blossom88.com/learn/previews.md
summary: Give each pull request a full copy of your App, database included
categories:
- learn
- previews
---

# Preview Every Pull Request

A Preview is a full copy of an Environment, such as production or staging,
running another branch or pull request on its own URL. Full means the
database too: each Preview gets its own, so you review a change running for
real, end to end, before it ships. Ask your agent:

> Create a Preview for each pull request.

## Three Ways To Create Previews

| Create | How |
|---|---|
| By hand | `environment:preview:create --branch checkout-redesign` |
| For every pull request | `pull_requests: true` |
| For matching branches | `branch_pattern: preview/*` |

## Turn On Pull Requests

    blossom environment:preview:settings:init

preview_settings.yml:

```yaml
preview_settings:
  expiry_days: 7 # delete after this many days without a deploy
  limit: 10 # most Previews at once
  pull_requests: true # each pull request into this branch gets a Preview
  # setup_command: bin/rails db:prepare db:seed # once, before the first release
```

    blossom environment:preview:settings:update --environment environment-100 --data preview_settings.yml

The repository needs to come through a connected Git provider: GitHub, GitLab
or Bitbucket.

## What You Get

- **A full copy:** the same Services, build settings and variables as its
  Environment, on the branch you're testing.
- **Its own database:** a PostgreSQL database of its own when your App links
  one, never production's data.
- **Starting data:** seed every new Preview's database from a file, or run a
  setup command such as `db:seed`.
- **Its own URL,** posted on the pull request on GitHub and updated on each
  push.
- **Access:** open to your Account's members by default; share a link with
  anyone else.
- **Variables:** override one for Previews, such as a sandbox payment key.
- **Cleans up after itself:** deleted when the pull request closes, or after 7 days
  without a deploy.

See [Preview Environments](/docs/apps/preview-environments/) for
every setting, and [Environment Access](/docs/apps/environment-access/)
for who can open them.
