podspawnpodspawn

Branch Workspaces

Run multiple isolated local machines from one registered project, each pinned to its own branch and host checkout

Branch workspaces let you spin up several persistent local machines from a single registered project, each backed by its own checkout under ~/.podspawn/workspaces/<name>/. The workspace survives stop and is reused on shell, so you can park a half-finished feature branch and come back to it days later.

Walkthrough

Register the project once

podspawn add-project backend --repo https://github.com/company/backend

add-project records the repo URL in ~/.podspawn/projects.yaml. You only do this once per project.

Create a branch-specific machine

podspawn create auth-fix --project backend --branch feat/auth-retry
✓ Creating auth-fix (podspawn/auth-fix:podfile-...)

Podspawn clones feat/auth-retry into ~/.podspawn/workspaces/auth-fix/, builds the Podfile image, mounts the checkout into the container, runs on_create once, then on_start.

Attach a shell

podspawn shell auth-fix
karthik@auth-fix:/workspace/backend$

The container starts in the bind-mounted checkout. Edits inside the container are visible on the host and vice versa.

Park it

podspawn stop auth-fix

The container, network, and sidecars are removed. The host checkout and the machine row in the state DB stay.

Pick it up later

podspawn shell auth-fix

shell recreates the container from the saved workspace without recloning. on_start runs again; on_create runs only if the previous initialization never finished.

Discard when done

podspawn rm auth-fix

Removes the workspace directory and the machine row. Use --force if a session is still running.

Lifecycle

create  -->  running  -->  stop  -->  stopped workspace  -->  rm
                ^                           |
                |    shell                  |
                +---------------------------+

Prop

Type

Branch resolution

Switching branches in place

podspawn switch-branch auth-fix release/1.4

Runs git fetch and git checkout inside the workspace without destroying the container. Use this instead of rm + create when you want to reuse the same machine for a different branch and don't need a clean slate.

Hook semantics

on_create reruns when a previous run failed before initialization completed. Keep it idempotent: re-running apt-get install, pip install, or schema migrations on an already-initialized workspace must not fail.

  • on_create runs once per workspace, after the clone, on the very first successful create. The completion flag is persisted on the machine row.
  • If on_create exits non-zero, podspawn tears down the container but keeps the checkout on disk. The next create or shell retries on_create against the same workspace.
  • on_start runs on every container start (including after stop/shell) and is non-fatal — failures are logged and the shell still attaches.
  • Local create does not forward an SSH agent. Hooks that need authenticated git access must use HTTPS tokens, gh auth, or another host-side credential path.

Ephemeral runs

podspawn run review --project backend --branch release/1.4

run follows the same branch resolution rules but clones into a temporary ~/.podspawn/workspaces/.tmp-<name>-<unix-nano>/ workspace and removes it on disconnect. If the process is interrupted mid-clone, the .tmp-* directory may remain — it's safe to delete manually once no matching session is running.

Use run for one-shot reviews and CI-like flows where you don't need state to survive disconnect. Use create whenever you expect to come back to the same checkout.

See also

How is this guide?

On this page