What is your developer-dependent CMS actually costing you? Calculate your costs and get a full report
What is your developer-dependent CMS actually costing you? Calculate your costs and get a full report
APIs
agility reverse-sync copies changes made on the target of an earlier sync back into its source, reusing the sync's mapping files. How it works, examples and exit behavior, for CLI 1.1.0.
agility reverse-sync copies changes made on the target of an earlier sync back into its source, reusing the mapping files that sync created. Items that were synced forward are updated in the source instead of duplicated.
Checked against @agility/cli 1.1.0. For the options every command shares, sign-in and exit codes, see the CLI command reference.
agility reverse-sync --sourceGuid=<original source> --targetGuid=<original target> [options]
From agility reverse-sync --help:
agility reverse-sync
Sync the target instance back to the source instance, reusing (and updating) the
mapping files from the original sync. Pass the same --sourceGuid/--targetGuid as
the forward sync.
Don't swap them. The CLI reverses the direction itself:
| Option | Meaning in reverse-sync (from --help) |
|---|---|
--sourceGuid | The ORIGINAL source instance GUID from the forward sync (this run writes INTO it). Required; falls back to AGILITY_GUID from .env. |
--targetGuid | The ORIGINAL target instance GUID from the forward sync (this run reads FROM it). Required; falls back to AGILITY_TARGET_GUID from .env. |
If either GUID is missing, or both are the same, the command stops with an error and exits 1.
agility-files/mappings/{sourceGuid}-{targetGuid}/, in their original orientation. No reversed folder is created.agility-files/mappings-backups/{sourceGuid}-{targetGuid}/{timestamp}/. With --preflight, nothing is written and no backup is taken. If the backup fails, the run stops before writing.All other sync options work the same way, including --locales, --elements, --models, --models-with-deps, --pages, --containers, --preflight, --overwrite, --autoPublish and --jsonSummary. See sync and push. In the JSON summary, a reverse sync is recorded with command set to sync.
# The forward sync, A to B
agility sync --sourceGuid="A-u" --targetGuid="B-u" --locales="en-us"
# Later: preview what bringing B's edits back into A would do
agility reverse-sync --sourceGuid="A-u" --targetGuid="B-u" --locales="en-us" --preflight
# Then run it
agility reverse-sync --sourceGuid="A-u" --targetGuid="B-u" --locales="en-us"
agility-files/mappings/. Without those mappings, nothing can be matched and items are created as new.sync and a reverse-sync for the same pair at the same time. Both rewrite the same mapping files.--preflight first and read the report. A reverse sync writes into the instance you originally treated as the source of truth.The same as sync, plus exit 1 when the GUIDs are missing or identical.