~/portfolio
NIT — A MINIMAL GIT IN RUST(7) — A minimal Git reimplementation written in Rust, building the core object model, binary index, and a subset of plumbing and porcelain commands from scratch — no libgit2, no git binary underneath.
($ cd ~/projects && ./nit)

NAME

Nit — A Minimal Git in Rust — A minimal Git reimplementation written in Rust, building the core object model, binary index, and a subset of plumbing and porcelain commands from scratch — no libgit2, no git binary underneath.

SYNOPSIS

A minimal Git reimplementation written in Rust, building the core object model, binary index, and a subset of plumbing and porcelain commands from scratch — no libgit2, no git binary underneath.

DESCRIPTION

Repository: GitHub - m-elhabib-dev/nit

Nit is a learning-oriented Git reimplementation written in Rust. It implements the core Git object model, index, and a subset of the plumbing and porcelain commands from scratch — no libgit2, no git binary underneath.

Repos created by Nit use the same on-disk format as Git, so they can be inspected with plain git (e.g. git log, git fsck) and vice versa, as long as you stick to the commands Nit supports.

Implemented commands:

  • nit init — create a .git repository skeleton
  • nit hash-object [-w] <file> — compute an object hash, optionally write it
  • nit cat-file -p <hash> — pretty-print an object
  • nit write-tree — write the working tree as a tree object
  • nit ls-tree [--name-only] <tree-hash> — list the entries of a tree
  • nit commit-tree -m <msg> [-p <parent>] <tree-hash> — write a commit object
  • nit commit -m <msg> — write tree + commit, update the current branch
  • nit add <file> — stage a file (or . for everything) into the index
  • nit status — show modified, deleted, and untracked files
  • nit clone <path> — clone a local repository

TECH STACK

Rust flate2 SHA-1 zlib Git Internals

ARCHITECTURE

Blobs, trees, and commits stored in .git/objects with SHA-1 naming and zlib compression via flate2. Binary index file compatible with Git format (header, entries, trailing SHA-1 checksum). On-disk format identical to real Git repositories. Partial HTTP smart-protocol implementation (git-upload-pack, pkt-line framing) for remote cloning.

BUGS / CHALLENGES

Packfiles containing OFS_DELTA and REF_DELTA objects are not fully supported — the remote-cloning experiment reached the PACK format and parses normal objects, but delta objects still need implementation. .gitignore is not implemented. Remote cloning over HTTP is incomplete. Windows path handling and non-UTF-8 filenames are not covered.

EXIT STATUS / OUTCOMES

Implemented the core Git object model and a Git-compatible binary index from scratch in Rust. Delivered working plumbing and porcelain commands including commit, status, add, and local clone. Produced repositories fully inspectable with real Git tooling.

SEE ALSO