Skip to content

History And Restore

Graft uses a Git-like repository model for app data:

worktree -> index -> commit

SQLite transactions update the current database state. Graft commits record which database snapshots and file artifacts should be treated as a named app state.

Terminal window
graft status
graft add --all
graft commit -m "save checkpoint"

Inspect history:

Terminal window
graft log
graft log --json
graft show HEAD
graft show --json HEAD

Create a branch:

Terminal window
graft branch feature/search
graft switch feature/search

Create and switch in one command:

Terminal window
graft switch -c feature/search main

List branches:

Terminal window
graft branch
graft branch -r
graft branch -a

Switching branches materializes the target commit’s tracked SQLite snapshots and file artifacts into the worktree.

Restore a worktree path from HEAD:

Terminal window
graft restore --source HEAD -- data.sqlite

Restore a path from an older revision:

Terminal window
graft restore --source HEAD~1 -- attachments/report.pdf

Unstage a staged path:

Terminal window
graft restore --staged -- data.sqlite

Unstage every staged path of one kind:

Terminal window
graft restore --staged --all --kind sqlite_database

Check out an entire revision:

Terminal window
graft checkout HEAD~1

Restore one path from a revision:

Terminal window
graft checkout HEAD~1 data.sqlite

Use checkout for revision movement or Git-style path restore. Use restore for explicit staged/worktree restore operations.

Move the current branch while keeping staged and worktree state:

Terminal window
graft reset --soft HEAD~1

Move the branch and reset the index:

Terminal window
graft reset --mixed HEAD~1

Move the branch, reset the index, and materialize the target revision:

Terminal window
graft reset --hard HEAD~1

--hard discards staged and unstaged worktree changes. Use it only when that is the intended operation.

Create a lightweight tag:

Terminal window
graft tag v0.1

Create an annotated tag:

Terminal window
graft tag -a v0.1 -m "first checkpoint"

List or delete tags:

Terminal window
graft tag
graft tag -d v0.1