Skip to content

Overview

Graft turns a directory of SQLite databases into a repository:

project/
app.db
analytics.db
.graft/
config.toml
HEAD
refs/
objects/
store/
index/

The .graft/ directory is the project boundary. It stores repository metadata, immutable objects, refs, remote configuration, and the repo-local Graft storage used by SQLite database snapshots.

  1. Initialize or clone a repository.

    Terminal window
    graft init
  2. Modify SQLite data through the Graft VFS.

    Terminal window
    graft sql "CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT);"
    graft sql "INSERT INTO users(name) VALUES ('Alice');"
  3. Stage the current database snapshot.

    Terminal window
    graft add app.db
  4. Commit the staged snapshot.

    Terminal window
    graft commit -m "seed users"
  5. Branch, switch, fetch, pull, push, diff, and restore using repository revisions.

    Terminal window
    graft branch feature/search
    graft switch feature/search
    graft diff main HEAD app.db

SQLite transactions and Graft commits are intentionally separate. A SQLite transaction makes database writes atomic. A Graft commit records a project version.