# Checkpoints, forks and resets

> Snapshot a branch, copy it many times, and go back.

A **checkpoint** is a snapshot of a branch. Taking one is an [operation](/docs/concepts/operations/); when it succeeds, the checkpoint is `ready`.

```sh
elefork checkpoint create br_... --name before-migration
elefork checkpoint list br_...
```

What you can do with a ready checkpoint:

- **Create branches from it:** `{"checkpoint": "ckp_..."}`, optionally with `count`. This is the fast way to give each RL episode or test its own identical database.
- **Fork from it:** `{"parent": "br_...", "checkpoint": "ckp_..."}` does the same, and also records the parent.
- **Reset to it:** `POST /v1/branches/{id}/reset` with `{"checkpoint": "ckp_..."}`. Everything written after the checkpoint is discarded. The branch keeps its id and hostname, but gets a new instance (a new [generation](/docs/concepts/branches/#generations)), and open connections are closed.

## Fork now

`{"parent": "br_..."}` without a checkpoint forks the parent as it is at that moment. Elefork takes a checkpoint of the parent first; the response includes that checkpoint's operation as `fork_checkpoint_operation`.

## What a checkpoint contains

A checkpoint captures the instance at that moment: database files and memory. Commit or roll back your transactions before taking one.

Checkpoints are deleted when their branch is deleted, unless another branch was created from them.
