> ## Documentation Index
> Fetch the complete documentation index at: https://libops-renovate-github-com-libops-sitectl-0-x.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# sync

> Copy Drupal artifacts between sitectl contexts.

Use `sync` to pull production data down to a local context for development, or to promote content between environments.

## sync database

Copy the Drupal database from a source context to a target context.

This backs up the database on the source, transfers the artifact, and imports it into the
target. The command asks for confirmation before importing. Pass `--yolo` to skip the prompt
in automation.

Use `--fresh` to always take a new backup rather than reusing one from today.

```bash theme={null}
sitectl drupal sync database
```

| Flag           | Default                              | Description                                                   |
| -------------- | ------------------------------------ | ------------------------------------------------------------- |
| `--backup-dir` | `/tmp/sitectl-drupal-jobs/db-backup` | Directory on the source host used to cache backup artifacts.  |
| `--fresh`      | `false`                              | Always take a fresh backup instead of reusing one from today. |
| `--source`     |                                      | Source sitectl context.                                       |
| `--target`     |                                      | Target sitectl context.                                       |
| `--yolo`       | `false`                              | Skip the confirmation prompt before importing.                |

## sync config

Copy the Drupal configuration from a source context to a target context.

This exports config as a tarball from the source, transfers it, and imports it on the target
using drush cim.

```bash theme={null}
sitectl drupal sync config
```

| Flag              | Default | Description                                                                   |
| ----------------- | ------- | ----------------------------------------------------------------------------- |
| `--drupal-rootfs` |         | Path to the Drupal web root on the target, relative to the project directory. |
| `--source`        |         | Source sitectl context.                                                       |
| `--target`        |         | Target sitectl context.                                                       |

## Typical workflow

Pull the production database to your local context before starting a new feature:

```bash theme={null}
sitectl drupal sync database --source prod --target local
```

After updating configuration locally, push it back up:

```bash theme={null}
sitectl drupal sync config --source local --target stage
```
