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. Brought to you by GitButler ⧓.

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

# install via shell script (macOS / Linux)
$ curl -fsSL https://grit-scm.com/install | sh

$ grit status --short
 M docs/index.html

$ grit log --oneline --decorate -2
cc96ca5 (HEAD, main) gc
5ac721e update index parsing

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

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

Git Test Suite Progress

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

99.3%
t0 basics99.9%
t1 database99.4%
t2 worktree99.0%
t3 ls-files98.9%
t4 diff98.9%
t5 fetch/push99.4%
t6 revisions98.8%
t7 porcelain99.5%
t8 forensics99.6%
t9 tools99.4%

Latest generated harness pass rate: 41,715 of 42,001 in-scope tests. 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

Try it out.

Install the grit CLI and use it as a drop-in replacement for git. Pre-built binaries for macOS, Linux, and Windows, or install via Cargo.

curl -fsSL https://grit-scm.com/install | sh
installs grit and gs, or cargo install grit-cli
irm grit-scm.com/install.ps1 | iex
installs gs (run in PowerShell), or cargo install grit-simple