hash/
SHA-1 padding and block processing, plus the Huffman codec used for object storage.
sha1.cpp · huffman.cpp
A Git-like VCS, written from scratch
SHA-1 by hand. A Merkle tree for every directory. A DAG for history. An LCS table and Myers' algorithm for diffs. A BFS merge-base for three-way merges. C++17 and the standard library, nothing else.
The demo snapshot could not be loaded. Run minigit export > data.json
and serve this folder over HTTP.
A real snapshot from minigit export. Every node is a commit,
every edge a parent pointer. Click a commit to inspect it.
The same two algorithms the CLI uses, ported to JavaScript for this page.
LCS builds an n × m DP table; Myers walks diagonals and stays
cheap for small changes.
Small modules, one job each, wired together by a repository facade.
SHA-1 padding and block processing, plus the Huffman codec used for object storage.
sha1.cpp · huffman.cpp
Blobs, trees and commits with a sharded, content-addressed store. Trees are sorted, so equal directories produce equal ids.
object_store.cpp · tree.cpp · commit.cpp
Index, HEAD and refs, Merkle tree construction, branch checkout, history walking and merge orchestration.
repository.cpp · history.cpp · ignore.cpp
LCS dynamic programming, Myers greedy diff and unified hunk rendering with context merging.
lcs.cpp · myers.cpp · unified.cpp
Two BFS passes for the merge base, then a line-level three-way merge that emits conflict markers.
lca.cpp · three_way.cpp
Command parsing, git-style output and the ASCII DAG renderer with lanes and merge connectors.
main.cpp · graph.cpp
.minigit/
HEAD ref: refs/heads/main
index <object-id> <path>
objects/ab/cdef… Huffman-compressed objects, sharded by 2 hex chars
refs/heads/main commit id
object = "<type> <size>\0<payload>"
blob = file bytes
tree = "100644 blob <id> name\n" per entry
commit = tree + parents + author + timestamp + message
Eight commands, one binary, no dependencies.
| Command | What it does |
|---|---|
init | Create the object store, HEAD and refs |
add <path>… | Hash files into blobs and stage them |
commit -m "msg" | Write trees + a commit and advance the branch |
status | Staged, unstaged and untracked changes |
log [--graph] | Walk the DAG, plain or as ASCII lanes |
branch [name] | List branches or create one at HEAD |
checkout <rev> | Switch branch or detach at a commit |
diff [--staged] [--myers] | Unified diff via LCS or Myers |
merge <branch> | Fast-forward or three-way merge with conflicts |
export | JSON snapshot that powers this page |