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
gitbinary and no C library.
Read a repository
Section titled “Read a repository”Print the first ten commits in HEAD’s history. The getting started page
builds this program step by step.
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(())}jj on girt compared with stock jj
Section titled “jj on girt compared with stock jj”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 time | girt vs stock jj | ||||
|---|---|---|---|---|---|
| Command | girt | stock jj | Git | Ratio | Bar |
jj status | 560 ms | 420 ms | 9.63 s | 1.3× slower | |
jj log | 203 ms | 210 ms | 5.64 s | about the same | |
jj diff | 710 ms | 472 ms | 15.5 s | 1.5× slower | |
jj commit | 2.12 s | 1.13 s | 11.7 s | 1.9× slower | |
jj describe | 1.60 s | 951 ms | 9.89 s | 1.7× slower | |
jj rebase | 1.70 s | 1.07 s | 423 ms | 1.6× slower | |
jj git fetch | 850 ms | 985 ms | 744 ms | 1.2× faster | |
jj git push | 1.81 s | 1.77 s | 1.44 s | about the same | |
jj git clone | — | 4 min 53 s | 4 min 53 s | times 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