Skip to main content
env-twin provides a suite of commands to help you manage environment files across your projects. All commands support the --help flag for detailed usage information.

Available Commands

sync

Synchronize environment variable keys across all .env* files

restore

Restore .env* files from backups with automatic recovery

clean-backups

Delete old backups while keeping recent ones
Running env-twin without a command generates a .env.example file from your .env file (see Default Command section below).

Command Summary

CommandDescriptionKey Features
syncSynchronizes environment variable keys across all .env* filesInteractive key resolution, automatic backups, source of truth detection
restoreRestores .env* files from backupsAuto-selects most recent backup, rollback capability, dry-run mode
clean-backupsManages backup retentionConfigurable retention count, confirmation prompts
defaultCreates .env.example from .envSimple key extraction with placeholder values

Global Options

These options are available across multiple commands:
--help
flag
Display command-specific help informationAliases: -h
--version
flag
Display the current version of env-twinAliases: -v
--yes
flag
Skip confirmation prompts and auto-accept actionsAliases: -yAvailable in: sync, restore, clean-backups
--verbose
flag
Enable verbose logging for detailed operation informationAliases: -VAvailable in: restore

Default Command

When you run env-twin without a subcommand, it operates in legacy mode, creating a .env.example file from your .env file:
# Generate .env.example from .env
env-twin

# Specify custom source and destination
env-twin --source .env.development --dest .env.dev.example

Default Command Options

--source
string
default:".env"
Source .env file pathAliases: --src
--dest
string
default:".env.example"
Destination .env.example file pathAliases: --destination, --d, --out, --target
The default command removes all values and replaces them with placeholder values based on the key names (e.g., DATABASE_URL="input_database_url").

Quick Start Examples

env-twin sync

Getting Help

For detailed information about any command, use the --help flag:
env-twin --help              # General help
env-twin sync --help         # Sync command help
env-twin restore --help      # Restore command help
env-twin clean-backups --help # Clean-backups command help

Next Steps

Sync Command

Learn about synchronizing environment files

Restore Command

Explore backup restoration features

Build docs developers (and LLMs) love