vitna.ai/docs/operations/rolling-back Machine view
Raw .md llms.txt
> Source: https://vitna.ai/docs/operations/rolling-back
> Raw Markdown: https://vitna.ai/docs/operations/rolling-back.md
> Corpus index: https://vitna.ai/llms.txt

# Rolling back

Most failures roll themselves back. One kind needs a person.

## The kind that rolls itself back

The hook builds, migrates and seeds before restarting anything, and aborts on the
first of those that fails. The previous build keeps serving and the service never
moved. The log names which step failed.

Nothing to undo. Fix it and push again.

## The kind that needs a person

A deploy that succeeded and should not have.

Push the last good commit to the box. Because that moves the branch backwards it
has to be forced:

```bash
git push --force vps <last-good-sha>:refs/heads/main
```

The hook treats it as any other deploy, so
[verify it](verifying-a-deploy.md) the same way.

## Two things a push cannot undo

**Migrations are forward-only.** An older build meets a newer schema. The schema
is additive by construction and an older build ignores what it does not know
about, so this is usually fine. A migration that **dropped or narrowed**
something is not a rollback, it is a restore from the nightly dump.

**The bad commit is still the remote's main.** The next push redeploys it.
Revert it there too, or the box returns to the state you just left.

That second one is the trap, because the box is correct and the repository is
not, so everything looks fixed until somebody else pushes.
Human Machine Shift+M