---
title: "Pull, push, compare and validate resources"
slug: "pull-push-compare-and-validate-resources"
abstract: "How to pull, push, compare and validate resources using serialization commands after you initialize your working folder."
---
# Pull, push, compare and validate resources

Using serialization commands, you can pull, push, compare, and validate [resources](https://doc.sitecore.com/ch/en/developers/cloud-dev/create-resources.html "Create resources"). You can then [create and install a package](https://doc.sitecore.com/ch/en/developers/cloud-dev/create-and-install-a-package.html "Create and install a package").

> [!note]
> **Before you begin**
> -   [Initialize your working folder](https://doc.sitecore.com/ch/en/developers/cloud-dev/initialize-your-working-folder.html "Initialize your working folder")

> [!note]
> In some of the examples in this section, the `--name` parameter has a value that includes a wildcard. Assigning wildcards to a parameter lets you target data based on a pattern instead of a literal value. For example, using the `name` value of `MyNamespace*` affects all resources with a name that starts with `MyNamespace`.

## Pull

To fetch resources from the connected Content Hub instance, use the `pull` command. The working directory is initialized automatically when pulling resources for the first time.

You can specify what type of resource to fetch by appending parameters to the command, as shown in the following examples:

```shell
# Pulling all option lists
ch-cli serialization pull option-list

# Option lists
ch-cli serialization pull option-list -?

# Pulling option list by its name
ch-cli serialization pull option-list -n <NAME>

# Pulling all entity definitions
ch-cli serialization pull entity-definition

# Entities
ch-cli serialization pull entity -?

# Entity definitions
ch-cli serialization pull entity-definition -?

# Pulling an option list by its name
ch-cli serialization pull entity-definition -n <NAME>

# Pulling an entity by id
ch-cli serialization pull entity --id <ENTITY_ID>

# Pulling an entity by identifier
ch-cli serialization pull entity --id <ENTITY_IDENTIFIER>

# Pulling an entity by name and definition
ch-cli serialization pull entity --name <ENTITY_NAME> --definition <ENTITY_DEFINITION_NAME>

# Pulling all entities for an entity definition
ch-cli serialization pull entity --definition <ENTITY_DEFINITION_NAME>

# Pulling an entity and its related entities
ch-cli serialization pull entity --name <NAME> --definition <ENTITY_DEFINITION_NAME> --include-relations

# Policies
ch-cli serialization pull pol --name
ch-cli serialization pull pol --id
ch-cli serialization pull pol --name  --verbose --updates --minutes
ch-cli serialization pull policy --name
ch-cli serialization pull policy --id
ch-cli serialization pull policy --name  --verbose --updates
ch-cli serialization pull policy --name  --verbose --minutes
```

> [!note]
> The `id` (for example, `34167`) and the identifier (for example, `asset.mae-mu-1421987`) are separate system properties. Entity names are resolved based on the `DisplayTemplate` property of their respective [entity definitions](https://doc.sitecore.com/ch/en/users/content-hub/en/edit-an-entity-definition.html). If the `DisplayTemplate` property does not have a value, the entity identifier is used as the entity name. To resolve a name collision, append the entity identifier to its name.

## Push

To push resources to the connected Content Hub instance, use the `push` command. You can specify what type of resource to push by appending parameters to the command, as shown in the following examples:

```shell
# Push a single option list by its name
ch-cli serialization push option-list --name <NAME>

# Push all option lists
ch-cli serialization push option-list

# Push a single entity definition by its name
ch-cli serialization push entity-definition --name <NAME>

# Push all entities of a certain definition
ch-cli serialization push entity --definition <DEFINITION_NAME>

# Push all entities
ch-cli serialization push entity

# Policies
ch-cli serialization push pol --name
ch-cli serialization push policy --name
ch-cli serialization push pol --name --verbose

```

## Compare

Use the `diff` command to examine resources available locally and those present in the Content Hub instance, and then highlight any differences. By default, the output shows a high-level overview of whether an entity was updated (`[U]`), added (`[A]`) or deleted (`[D]`). To see detailed changes, you can append the `--verbose` flag to the command.

```shell
[U] SampleArticle
 [U] fields
  [U] id: Title
   [U] required
     false - true
  [A] id: ReleaseDate

```

To compare resources, run one of the following commands:

```shell
# Compare all option lists
ch-cli serialization diff option-list

# Compare an option list by name
ch-cli serialization diff option-list --name <name>

# Compare all entity definitions
ch-cli serialization diff entity-definition

# Compare an entity definition by name
ch-cli serialization diff entity-definition --name <name>

# Compare all entities
ch-cli serialization diff entity

# Compare entities by name and definition
ch-cli serialization diff entity --name <NAME> --definition <ENTITY_DEFINITION_NAME>

# Policies
ch-cli serialization diff pol --name
ch-cli serialization diff pol --name  --verbose
ch-cli serialization diff policy --name
```

## Validate

The CLI validates the YAML files to ensure, for example, that they use unique IDs, valid culture identifiers, and respect field length restrictions.

To validate resources locally, even while working on them, run one of the following commands:

```shell
# Validates options lists
ch-cli serialization validate option-list

# Validates entity definitions
ch-cli serialization validate entity-definition

# Validates entities
ch-cli serialization validate entity

```