TimeMachine is a command-line tool for creating and managing directory snapshots. It provides efficient file versioning with features like deduplication, change tracking, and point-in-time restoration.
# Install
brew tap masiedu4/timemachine
brew install masiedu4/timemachine/timemachine
# Update
brew update
brew upgrade timemachineFor other installation methods, see the README.
timemachine [COMMAND] [OPTIONS] [ARGUMENTS]Initialize a directory for version tracking.
timemachine init <DIRECTORY>Arguments:
DIRECTORY: Path to the directory to initialize (required)
Example:
# Initialize a project directory
timemachine init ~/projects/my-app
# Initialize current directory
timemachine init .Create a new snapshot of the current directory state.
timemachine snapshot <DIRECTORY>Arguments:
DIRECTORY: Path to the directory to snapshot (required)
Example:
# Take a snapshot of a project
timemachine snapshot ~/projects/my-app
# Take a snapshot of current directory
timemachine snapshot .List all snapshots for a directory.
timemachine list <DIRECTORY> [--detailed]Arguments:
DIRECTORY: Path to the directory (required)--detailed: Show additional information including space usage
Examples:
# Basic listing
timemachine list ~/projects/my-app
# Detailed listing with space usage
timemachine list ~/projects/my-app --detailedShow the current status of a directory.
timemachine status <DIRECTORY>Arguments:
DIRECTORY: Path to the directory to check status (required)
Example:
# Check status of a project
timemachine status ~/projects/my-app
# Check status of current directory
timemachine status .Compare two snapshots to see what has changed.
timemachine diff <DIRECTORY> <SNAPSHOT_ID_1> <SNAPSHOT_ID_2>Arguments:
DIRECTORY: Path to the directory (required)SNAPSHOT_ID_1: ID of the first snapshot to compare (required)SNAPSHOT_ID_2: ID of the second snapshot to compare (required)
Example:
# Compare snapshots 1 and 2
timemachine diff ~/projects/my-app 1 2
# Compare current directory snapshots
timemachine diff . 1 2Restore a directory to a specific snapshot state.
timemachine restore <DIRECTORY> <SNAPSHOT_ID> [--dry-run] [--force]Arguments:
DIRECTORY: Path to the directory to restore (required)SNAPSHOT_ID: ID of the snapshot to restore to (required)
Options:
--dry-run: Show what would be changed without making actual changes--force: Force restore even if there are uncommitted changes. This will:- Create a backup snapshot of the current state
- Override any uncommitted changes
- Restore to the specified snapshot
Examples:
# Restore directory to snapshot #5
timemachine restore /path/to/dir 5
# Preview changes without applying them
timemachine restore /path/to/dir 5 --dry-run
# Force restore even with uncommitted changes
timemachine restore /path/to/dir 5 --forceDelete a specific snapshot.
timemachine delete <DIRECTORY> <SNAPSHOT_ID> [--cleanup]Arguments:
DIRECTORY: Path to the directory (required)SNAPSHOT_ID: ID of the snapshot to delete (required)--cleanup: Immediately remove content unique to this snapshot
Cleanup Behavior:
- Without
--cleanup: Content is automatically cleaned up when:- All snapshots are deleted
- Orphaned content exceeds 100MB
- With
--cleanup: Immediately removes content unique to the deleted snapshot - Space savings are reported after each cleanup operation
Examples:
# Delete a snapshot (automatic cleanup if orphaned content exceeds threshold)
timemachine delete ~/projects/my-app 2
# Delete and immediately clean up content unique to this snapshot
timemachine delete ~/projects/my-app 2 --cleanupTimeMachine provides shell completion support for:
- Bash
- Zsh
- Fish
- PowerShell
To generate completion scripts:
timemachine completions [SHELL]Arguments:
SHELL: Optional shell name (bash, zsh, fish, powershell)
If no shell is specified, generates completions for all supported shells.
Common error scenarios:
-
Directory Access:
- Directory not found or inaccessible
- Insufficient permissions
-
Snapshot Operations:
- Snapshot not found
- Invalid snapshot ID
- Insufficient space
-
Restore Operations:
- Uncommitted changes present
- Insufficient space
- Invalid restore point
-
Regular Snapshots
- Take snapshots at meaningful points (after major changes)
- Use descriptive commit messages
- Regular snapshots make restoration easier
-
Space Management
- Regularly clean up old snapshots
- Use
--cleanupwhen deleting snapshots - Monitor available space with
statuscommand
-
Safe Restoration
- Always use
--dry-runfirst - Ensure sufficient space before restoration
- Back up important files before large restores
- Always use
-
Performance
- Avoid tracking large binary files
- Exclude temporary and build files