███████╗██████╗ ██████╗ ██████╗██╗ ██╗
██╔════╝██╔══██╗██╔═══██╗██╔════╝██║ ██║
█████╗ ██████╔╝██║ ██║██║ ███████║
██╔══╝ ██╔═══╝ ██║ ██║██║ ██╔══██║
███████╗██║ ╚██████╔╝╚██████╗██║ ██║
╚══════╝╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝
Epoch is a lightweight, high-performance, Git-inspired version control system built completely from scratch in C++17. Because git init was too easy. 😉
-
Content-Addressable Storage: Objects are securely stored and sharded based on their cryptographic hashes (
2-character directory prefixingto optimize filesystem performance). - Dynamic Hashing: Supports runtime toggling and validation between SHA-1 and SHA-256 hashing algorithms.
-
Efficient Compression: Integrates the
minizlibrary to deflate and compress object snapshots and commit logs while keeping theindexandHEADpointers transparently in plaintext. -
JSON-Backed Indexing: Powered by
nlohmann/jsonto map file paths to hashes with$O(1)$ lookup performance. -
Line-by-Line Diff Engine: Leverages the Diff Template Library (
dtl) alongsiderangfor colorized, terminal-native patch comparisons between working trees and historical commits.
Epoch relies on modern C++ features and clean, header-only external libraries housed in src/libs/:
| Library / Feature | Purpose |
|---|---|
C++17 std::filesystem |
Cross-platform file, directory navigation, and path management |
CLI11 |
Robust, sleek command-line argument parsing |
nlohmann/json |
Fast and flexible JSON parsing for indices and commit metadata |
miniz |
Deflate/inflate compression for the object database |
dtl |
Diff Template Library for computing line-by-line patch changes |
stbrumme/hash-library |
Cryptographic hashing (SHA-1 and SHA-256) |
rang |
Terminal color formatting for clean CLI output |
-
init— Initialize repository structure (.epoch/,HEAD,index,objects) -
hash-object— Compute hashes, compress, and store blobs -
cat-file— Retrieve, decompress, and inspect object contents -
add— Stage files into the JSON index map -
commit— Package staged snapshots into compressed commit objects and updateHEAD -
log— Traverse and print chronological ancestry graph backwards fromHEAD -
diff— Compare historical commit snapshots against the working directory with colorized diffs -
status— Inspect and report working tree vs. staging index status (In Progress) -
branch— Create, list, or delete lightweight reference pointers -
checkout— Switch activeHEADor restore working files -
merge— Combine branch histories
Building a custom VCS from scratch is an incredible systems-programming rite of passage. These resources guided the architecture:
Epoch epoch;
epoch.init();
epoch.hashObject("main.cpp", true);
epoch.commit("Initial commit of Epoch core engine!");
epoch.log();Built with passion, C++17, and a deep appreciation for low-level systems engineering.