Runbook: rebuild Codespace¶
Status: Current | Last reviewed: 2026-05-28
Throw away the current Codespace and start fresh.
When to run¶
- Devcontainer is wedged and
wake-up.shwon't recover it. - Disk is full from leftover Docker images and
docker system pruneisn't enough. - Major dependency change in
setup.shand you want a clean baseline.
Steps¶
-
Save anything local that isn't committed:
bash git status git stash push -u -m "pre-rebuild" git push origin <your-branch>Warning:
git stashhas lost work in conflict resolution before. Back up any uncommitted file withcp -ato/tmp/backup-<timestamp>/before stashing. See the feedback-backup-before-stash memory note. -
Export a snapshot if you want the data back:
bash bash .devcontainer/dev-snapshot-export.shThe snapshot lands in your remote bucket; it includes Postgres, Redis, MinIO, and Overmind state. -
Delete the Codespace from the GitHub Codespaces UI.
-
Create a new Codespace on the desired branch.
-
Wait for
postCreateCommand(setup.sh) andpostStartCommand(wake-up.sh) to finish. The status bar shows progress. -
Restore the snapshot if you saved one:
bash bash .devcontainer/dev-snapshot-import.sh <snapshot-name> -
Restore stashed work:
bash git stash pop
Smaller alternative: just rebuild the container¶
In VS Code: Codespaces: Rebuild Container. This re-runs postCreateCommand and postStartCommand without losing the Codespace itself or its volumes.