# Backfill

{% tabs %}
{% tab title="Development" %}
The `backfill` command provides the ability to capture code changes in a database, when compared to what has been tracked/deployed previously using JadeGit (stored in the [registry](../../deployment/registry)).

<figure><img src="https://content.gitbook.com/content/Y1IAL1hDvA1grxYC9uyY/blobs/ssxzxy5MloibOOUoTxAN/image.png" alt=""><figcaption></figcaption></figure>

This command is useful for piloting JadeGit in conjunction with an existing change/deployment processes, with this command being run after an existing deployment process to capture/push what has just been deployed to the associated JadeGit repository (origin of which is stored in the registry).

The `--access-token` option can be used to supply a token for authorization purposes.

The `--branch` option is required to specify what remote branch needs to be updated.

The `--commit-message` option is required to specify the message to use when creating the commit for any changes detected.

The `--user-name` and `--user-email` options can be used to override the defaults otherwise used from the git config when creating the commit for any changes detected.

## How It Works

When the backfill command is run, the following steps are performed:

* Clone associated repository in a temporary folder (using the origin stored in the registry).
* Switch to the branch specified.
* Reset to the last known commit (stored in the registry).
* Perform a deep [extract]() of all schemas (excluding static/supplied schemas like CardSchema).
* If there's any changes:
  * Create a new commit using message specified.
  * Update registry to store new commit created.
* Push branch back to the origin (forcefully), irrespective of new commit being created (resets remote branch to match what's stored in registry when there are no changes).

{% hint style="info" %}
The repository clone is left in the temporary folder to act as a cache with it being updated when the backfill is run again (rather than cloning again from scratch).  This can be removed if preferred, as it will be cloned again from scratch as needed.
{% endhint %}
{% endtab %}

{% tab title="Standalone" %}
The `backfill` command isn't available in the standalone variant.
{% endtab %}
{% endtabs %}
