Skip to content

girt

A Rust library for Git repositories: objects, references, the index, the working tree, and fetch, clone and push. It reads and writes Git's on-disk formats and returns an error for anything it doesn't support. It is the Git backend for an experimental build of jj.

Install
cargo add girt
Status
Experimental. The API changes between minor releases.
Licence
MIT or Apache-2.0.
No subprocess
No git binary and no C library.

Print the first ten commits in HEAD’s history. The getting started page builds this program step by step.

src/main.rs
use girt::{HistoryLimits, PackLimits, ReadLimits, Repository};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let repository = Repository::open(".")?;
let head = repository.head()?;
let head_id = head.id.ok_or("HEAD has no commits yet")?;
let objects = repository.objects()?;
let history = objects.walk(&[head_id])?;
for id in history.into_iter().take(10) {
let commit = objects.read_commit(id)?;
let message = String::from_utf8_lossy(commit.message());
let summary = message.lines().next().unwrap_or_default();
println!("{id} {summary}");
}
Ok(())
}

girt’s first consumer is jj. This table runs the same jj commands on girt and on stock jj, which uses gix and the git executable, with the closest git command for reference.

Median timegirt vs stock jj
Commandgirtstock jjGitRatioBar
jj status560 ms420 ms9.63 s1.3× slower
jj log203 ms210 ms5.64 sabout the same
jj diff710 ms472 ms15.5 s1.5× slower
jj commit2.12 s1.13 s11.7 s1.9× slower
jj describe1.60 s951 ms9.89 s1.7× slower
jj rebase1.70 s1.07 s423 ms1.6× slower
jj git fetch850 ms985 ms744 ms1.2× faster
jj git push1.81 s1.77 s1.44 sabout the same
jj git clone—4 min 53 s4 min 53 stimes out

Everyday commands on the Linux v6.1 kernel repository. Across all three repositories, jj on girt is less than 20% slower than stock jj (or faster) in 109 of the 152 cells where both finished; 1 more did not finish with girt. Apple M2 Max, girt 0.11.1–0.14.0, measured 2026-10-17. All results

Biggest gaps, by extra wait over stock jj: jj git clone on Linux v6.1 times out (issue 581); jj file annotate on Linux v6.1 1.1× slower; jj log on Linux v6.1 about the same. Performance page