the Grit project

Git, rewritten by agents, in Rust, as a library.

Grit is an agent-driven, library-oriented reimplementation of Git in Rust, aiming to pass Git's own test suite.

grit-lib provides Git behavior as typed Rust modules;
grit-rs is the Git-compatible CLI built to pass Git's own test suite.

# grit-rs installs a Git-compatible CLI
$ cargo install grit-rs
$ grit status --short
 M docs/index.html

$ grit log --oneline --decorate -3
cc96ca5 (HEAD, main) gc
8f2d1a0 implement promisor hydrate
5ac721e update index parsing

$ grit diff --stat HEAD~1..HEAD
 grit-lib/src/repo.rs | 42 ++++++++++++++++++++
// Cargo.toml
grit-lib = "0.1"

use grit_lib::repo::Repository;

let repo = Repository::discover(".")?;
let head = grit_lib::state::resolve_head(&repo.git_dir)?;

if let Some(oid) = head.oid() {
    let obj = repo.odb.read(oid)?;
    println!("{} {} bytes", obj.kind, obj.data.len());
}
Current status

Passing the Git Test Suite

Grit is tracked against the upstream Git harness. The generated dashboard shows pass rate by family, skipped files, and per-file status.

49.7%
t0 basics88.7%
t1 database40.8%
t2 worktree53.9%
t3 ls-files74.2%
t4 diff37.6%
t5 fetch/push57.0%
t6 revisions56.9%
t7 porcelain58.4%
t8 forensics24.1%
t9 tools25.6%

Latest generated harness pass rate. Open the dashboard for exact counts.

Letter from the editor

Why this exists.

For over 15 years, I've wanted a full implementation of git that was available as a nice, reentrant library. Not a fork-exec'd wrapper around the command line, but a real library that didn't die whenever it got scared.

When I read about the Anthropic experiment to build a C compiler from scratch using agents and test suites, I thought that was a pretty cool idea. Maybe I could do that to make the library of my dreams, in Rust.

So here we are. Grit is the result of that experiment: an agent-driven reimplementation of Git in Rust, built to pass Git's own test suite. Hopefully I can get it to the finish line.

Love, Scott

What can it do?

Grit already covers the core Git building blocks in both the reusable library and the Git-compatible CLI.

Start with the crate.

Add grit-lib, open a repository, and use the modules you need. Runnable examples cover objects, the index, rev-list, cherry-pick, and more.