Skip to main content

vers commit

Save the current state of a VM as a commit.

Synopsis

vers commit                          # Commit current HEAD VM
vers commit <vm-id|alias>           # Commit specific VM

Description

The commit command creates a snapshot of a VM’s current state by saving it as a commit. This preserves the exact state of the VM at a specific point in time. You can commit either your current HEAD VM or specify a particular VM by ID or alias.

Basic Usage

Commit Current HEAD VM

vers commit
Creates a commit of whatever VM your HEAD currently points to.

Commit Specific VM

vers commit vm-abc123
vers commit my-app-vm
Creates a commit of the specified VM by ID or alias.

What Happens During Commit

  1. VM Identification: Resolves the target VM (provided or HEAD)
  2. State Capture: Creates a snapshot of the VM’s current state
  3. Commit Creation: Saves the commit via the API with a 60-second timeout

Examples

Development Workflow

# Commit current work in progress
vers commit

# Commit specific VM after testing
vers commit test-vm

Release Process

# Commit production environment
vers commit production-vm

Multiple Environment Commits

# Commit development environment
vers commit dev-env

# Commit staging environment
vers commit staging-env

# Commit production environment
vers commit prod-env

Commit Output

When you commit, you’ll see detailed information:
vers commit my-app
Using provided VM: my-app
Creating commit for VM 'vm-abc123'
Creating commit...
Successfully committed VM 'my-app'
Commit ID: c1a2b3c4d5e6f7g8
The output includes:
  • Commit ID: Unique identifier for this commit

Using HEAD VM

When no VM is specified, the command uses your current HEAD:
# Check your current HEAD
vers checkout
Current HEAD: my-dev-vm (State: Running)

# Commit it
vers commit
Using current HEAD VM: vm-def456
Creating commit for VM 'vm-def456'
...

Error Scenarios

VM Not Found

vers commit nonexistent-vm
# Error: failed to find VM: VM not found
Solution: Verify the VM ID/alias exists with vers status.

No HEAD Set

vers commit
# Error: failed to get current VM: no HEAD set
Solution: Use vers checkout <vm-id> to set a HEAD, or specify a VM explicitly.

Timeout

vers commit large-vm
# Error: failed to commit VM 'large-vm': context deadline exceeded
Solution: Commit operations have a 60-second timeout. Try again or check your network connection.

Tips

  • Commit before making risky changes to preserve known-good states
  • Use descriptive VM aliases to identify important snapshots later
  • You can restore from a commit using vers run-commit

See Also