sync

Synchronize variables between environments with interactive conflict resolution.

The sync command provides a powerful way to synchronize secrets between environments, with full control over what gets added, updated, or removed.

Usage#

redenv sync

Options#

FlagDescription
-p, --project <name>Project name

Examples#

# Sync interactively
redenv sync

# Sync specific project
redenv sync --project my-app

Interactive Flow#

$ redenv sync

? Select project: my-app
? Enter your Master Password: ********
? Select the SOURCE environment: production
? Select the DESTINATION environment: staging

 Fetching and comparing environments...
 Environments compared.

Changes to sync from production to staging:

? The following keys will be ADDED to staging. Select which to apply:
 NEW_API_KEY="sk_live_..."
 FEATURE_FLAG="enabled"

? The following keys will be UPDATED in staging. Select which to apply:
 DATABASE_URL: postgres://old... postgres://new...
 DEBUG: "false" "true"

? The following keys will be REMOVED from staging. Select which to apply:
 OLD_SECRET="..."

? You are about to apply 3 change(s) to the staging environment. This can be destructive. Are you sure? Yes

 Applying changes to staging...
 Successfully synced 3 change(s) to staging.

Info

Sync requires at least two environments. If environments are already identical, you'll see "Environments are already in sync. Nothing to do."

Change Types#

You can selectively apply each type of change:

  • Additions — Keys in source but not in destination
  • Updates — Keys with different values (shows before → after)
  • Removals — Keys in destination but not in source

Error

Sync can delete keys. Review removals carefully before confirming. This action is destructive and cannot be undone.

Sync vs Clone#

Featuresyncclone
DirectionSource → DestinationSource → Destination
Additions Select which to add Select which to add
Updates Select which to update Skips existing keys
Removals Select which to remove Never removes
Use caseFull environment alignmentCopy missing keys only
  • diff - Compare without modifying
  • clone - Copy missing keys only