ferrit is a minimal Git-like version control system written in Rust for learning purposes.
Currently implemented:
ferrit init— initializes a new repository by creating a.gitfolder with the required structureferrit cat-file -p <hash>— reads and prints the contents of a Git objectferrit hash-object -w <file>— computes the SHA-1 hash of a file, formats it as a Git blob object, and writes it to.git/objects/
cargo build./target/debug/ferrit initThis creates a .git directory with:
objects/refs/heads/- A
HEADfile pointing torefs/heads/main
The folder is now recognized by git status.
echo -n "hello world" > hello.txt
./target/debug/ferrit hash-object -w hello.txtThis prints the SHA-1 hash and stores the compressed object in .git/objects.
./target/debug/ferrit cat-file -p <hash>It prints the original content of the object. Example output:
hello world- Learn how Git works under the hood
- Build Git features from scratch using Rust
- Mimic Git CLI behavior step-by-step