vers branch
Create a new VM from an existing VM or commit, inheriting its complete state.Synopsis
Description
Thebranch command creates a new VM that inherits the complete state from an existing VM or commit. This allows you to continue from exactly where the source left off, but in a separate environment where you can make different changes.
When branching from a running VM, the parent is briefly paused to create a consistent snapshot, then a new VM spawns from that commit and the parent automatically resumes. Both VMs end up running simultaneously.
When branching from a commit ID, the new VM is created directly from that saved state.
Basic Usage
Create VM from Current HEAD
Create VM from Specific VM
Create VM with Custom Alias
Options
--alias, -n
Assign a custom alias to the new VM:
--checkout, -c
Automatically switch your HEAD to the new VM after creation:
What Happens When You Branch
When branching from a VM:- Parent Pauses: The source VM is briefly paused for a consistent snapshot
- Commit: The source VM’s current state is committed
- VM Creation: A new VM is spawned from that commit with a unique VM ID
- Parent Resumes: The source VM automatically resumes
- Both Run: Both parent and child VMs end up running simultaneously
- Optional Aliasing: If
--aliasis provided, the new VM gets a friendly name - Optional Checkout: If
--checkoutis used, your HEAD pointer switches to the new VM
- VM Creation: A new VM is spawned directly from the specified commit
- Optional Aliasing/Checkout: Same as above
Examples
Basic VM Creation
Creating and Switching
Creating from Specific VM
Creating from a Commit
Understanding Branch Output
When you create a VM, you’ll see output like:- Which VM was used as the source
- The new VM’s ID and alias (if provided)
- The current state of the new VM
- Instructions for switching to the new VM
Common Workflows
Experimentation
Parallel Development
Tips
- If you don’t specify
--alias, the new VM will only be accessible by its VM ID - Aliases are stored locally at
~/.vers/aliases.json- they don’t sync between machines - Use
--checkoutwhen you want to immediately start working on the new VM - The parent VM remains unchanged and accessible
See Also
- vers alias - View and look up aliases
- vers checkout - Switch between VMs
- vers commit - Create commits manually
- vers status - See your current HEAD and available VMs
- vers run-commit - Start a VM from a commit