Skip to Content

Backups

Manage local backups of your .aligntrue/ directory. For pushing rules to git remotes, use the remotes commands.

Usage

aligntrue backup <subcommand> [options]

Local backup subcommands

create

Create a manual local backup.

aligntrue backup create [--notes <text>]

Options:

  • --notes <text> - Add notes to the backup

Example:

aligntrue backup create --notes "Before major refactor"

list

List all available local backups.

aligntrue backup list

Shows timestamp, creation source, file count, and notes for each backup.

restore

Restore from a local backup.

aligntrue backup restore [--timestamp <id>]

Options:

  • --timestamp <id> - Restore a specific backup (default: most recent)

Examples:

# Restore most recent backup aligntrue backup restore # Restore specific backup aligntrue backup restore --timestamp 2025-10-29T12-34-56-789

aligntrue revert

Restore specific files from backup with preview before applying.

Usage:

aligntrue revert [options]

Options:

FlagAliasDescriptionDefault
--timestampRestore from specific backup (default: most recent)Most recent
--fileRestore specific file (shows preview first)All files
--forceSkip confirmation promptfalse
--config-cCustom config file path.aligntrue/config.yaml

What it does:

  1. Shows preview of files that will be restored
  2. Optionally filters to specific file
  3. Prompts for confirmation (unless --force)
  4. Restores selected files from backup
  5. Updates working directory

Examples:

# Preview and restore from most recent backup aligntrue revert # Preview before restoring specific file aligntrue revert --file .cursor/rules/typescript.md # Restore from specific backup with preview aligntrue revert --timestamp 2025-10-29T12-34-56-789 # Restore without confirmation (use carefully) aligntrue revert --force

Exit codes:

  • 0 - Success
  • 1 - No backup found, file not in backup
  • 2 - System error (permissions, restore failed)

cleanup

Remove old local backups based on retention policy.

aligntrue backup cleanup

Uses settings from config:

  • backup.retention_days - Remove backups older than N days (default: 30)
  • backup.minimum_keep - Always keep at least N backups (default: 3)

Global options

  • --config <path> - Path to config file
  • --help - Show help message

Configuration

Local backup config

backup: retention_days: 30 # 0 = disable auto-cleanup minimum_keep: 3 # Safety floor

Exit codes

  • 0 - Success
  • 1 - Error (backup not found, push failed, etc.)

See also

Last updated on