arche / wiki / Getting Started

Getting Started with Arche

Arche is a distributed version control system built from scratch in Go. It draws on the accumulated design experience of Git, Mercurial, Jujutsu, Darcs, Fossil, and others, aiming to keep what works and cut what doesn't. The name comes from the Greek ἀρχή: origin, foundation.

The most visible differences from Git are that there is no staging area, there is no detached HEAD, every change has a stable identity that survives rewrites, and the undo system is genuinely reliable. Those aren't surface conveniences. They follow from deliberate design choices in the object model and the way working copies are managed.

Initialising a Repository

arche init

Run this in an empty directory (or an existing one). Arche immediately writes an empty draft commit and records its change ID in .arche/HEAD. You never start a session in an undefined state; HEAD is valid from the first millisecond.

The repository lives in .arche/. The entire history (objects, bookmarks, phases, operation log) is in a single SQLite database at .arche/store.db. The issues tracker and wiki live in .arche/issues.db. There is no object directory, no loose pack format, no ref namespace to learn. Blobs larger than 128 KB are stored in .arche/packs/ as zstd-compressed append-only files, with a pack index in the database, but that's an implementation detail you never interact with directly.

Taking Your First Snapshot

Edits to the working directory are not staged. You just make changes and then run:

arche snap "Add initial implementation"

snap also accepts the aliases commit and snapshot; the rest of the documentation uses snap throughout.

This creates a named commit from whatever the working directory looks like at that moment. Arche hashes only the files that changed since the last snapshot (using size, inode, and modification time to detect unchanged files), writes tree and commit objects, and advances HEAD. The whole operation is one SQLite transaction, so it's either complete or it didn't happen.

To create a snapshot interactively, selecting which hunks to include, pass the -i flag:

arche snap -i "Partial fix for the auth bug"

This opens a TUI where you accept or reject individual diff hunks. Hunks you reject stay in the working directory as uncommitted changes. There is no staging area involved: the selection happens at snapshot time, not before.

Checking the Working Copy State

arche status

This shows the current HEAD change ID and its phase (draft, public, or secret), the commit message, any active bookmarks, and the list of modified, added, and deleted files. If the working copy contains conflict markers from a previous merge or rebase, those are reported here too.

arche diff

Shows a unified diff of the working copy against HEAD. Pass a commit reference to diff against an arbitrary ancestor instead.

The Operation Log and Undo

Every command that mutates state records a row in the operation log before returning. The row captures the complete ref state (HEAD and all bookmarks) before and after the operation, atomically in the same transaction as the change itself. This means:

arche undo

Always works. It restores HEAD and all bookmarks to their precise state before the last operation, then materialises the working copy to match. It records its own oplog entry, which means undoing an undo is also safe. Pass --step N to revert back N operations at once.

To see the history of operations (what commands were run and when):

arche op log

This is distinct from arche log, which shows the commit DAG.

arche co <ref>

Checks out a commit and materialises its tree as the working directory. The ref can be a change ID prefix (ch:7a3b), a content hash prefix (a3f8c), a bookmark name (main), or a relative reference (@- for the parent of HEAD, @-2 for the grandparent). HEAD always contains a change ID, never a bookmark name, so checking out by bookmark is structurally identical to checking out by ID.

Commit Log

arche log

Shows the commit graph backwards from HEAD and all visible bookmarks. Use -n to limit the count, --where to filter by a revset expression, -s to include secret commits, and --graph to display an ASCII representation of the DAG alongside the log.

Bookmarks

A bookmark is a mutable named pointer to a commit, equivalent to a Git branch. To create or update one:

arche bookmark set main

To delete:

arche bookmark delete old-feature

To list all bookmarks with their current commits:

arche bookmark list

Bookmarks are entirely optional for local work. You can do everything with change IDs and relative references. Bookmarks become important for syncing: arche sync operates on named bookmarks, and the forge UI uses them as the unit of review.

Ignoring Files

Arche uses .archeignore with the same syntax as .gitignore. The file is versioned (it's tracked in the repository tree), so changes to it take effect on the next snapshot. Global patterns for OS metadata and editor files go in ~/.config/arche/ignore.