Skip to content

gitbutlerapp/grit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7,292 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grit — Git in Rust

Grit is a from-scratch reimplementation of Git in idiomatic Rust. The goal is to match Git's behavior closely enough that the upstream test suite (under git/t/) can be ported and run against this tool.

The Grit project is brought to you by the mad geniuses at GitButler ⧓.

Progress

Harness test progress

Motivation

Why rewrite Git functionality into Rust? It's not about replacing Git, it's about having a feature-complete linkable library. It's similar to Gitoxide or libgit2/git2-rs, but using LLMs to try to acheive total feature parity by targeting the Git testing suite.

Approach

This implementation has been written nearly entirely by AI coding agents with the goal of entirely passing the C Git testing suite. For details on how we accomplished this, see our blog post.

The implementation is entirely in Rust, with most of the generic logic in the grit-lib library crate, and the Git-compatible CLI in the grit-cli crate which uses the library to provide a UI that passes the Git tests.

There is also a very simple alternative CLI called grit-simple (or gs) that is also installed with the install script and the only binary installed on Windows.

Usability

While the grit command emulates git functionality enough to successfully run over 42k of it's tests, it has been nearly entirely written by agents and has not been used for realsies. It's probably currently unusably slow or completely broken in ways that are not exercised in the test suite.

Our current goal is to get all the tests to pass and then refactor to real usability (speed, API surface, etc) while being able to successfully test for regression easily. Try it out and either send a fix or report an issue for anything you find or ways you want to use it that it doesn't successfully do.

Installation

To install the grit and gs CLIs via Bash, you can run our install script:

$ curl -fsSL https://grit-scm.com/install | sh

There are builds for Mac and Linux, (aarch64 and x86_64 for both). Linux ships both glibc and statically-linked musl binaries, so the installer works on distros like Alpine too — it auto-detects which one your system needs. Windows does not install grit, but does install the simple version gs that only does the basics.

Updating

To update your version of Grit CLIs, you can run grit update or gs update and it will re-run the install script.

grit-simple

The workspace also includes grit-simple, which installs the gs binary. It is not a Git-identical CLI; it is a simpler interface for common developer workflows built on grit-lib, portable to Windows.

gs treats status as the home screen and keeps the common path terse:

gs auth   # authenticate into github and store https auth tokens for fetch/push as your user
gs clone https://github.com/user/project
gs        # status dashboard
gs commit "message" # commit changes
gs switch -c topic
gs push
gs pull

It covers local work (status, add, commit, branch, switch, merge, log, config) plus remote basics (remote add, clone, fetch, pull, push) with plain-language output. Use grit when you need Git-compatible command behavior; use gs when you want the smaller workflow-oriented interface or something on Windows.

The Windows version also comes with gs manager which works as an interface to Windows Credential Manager to store gs auth tokens securely.

Rust Crates

Crate Description
grit-cli The grit binary — a drop-in CLI reimplementation of git with 140+ commands
grit-lib Core library: object model, diff engine, index, refs, revision walking, merge, config, and more
grit-simple The gs binary — a smaller workflow-oriented CLI backed by grit-lib
grit-examples Runnable examples of simple lib usage (add, cat-file, write-tree, hash-object, etc)
grit-test-support Workspace-only helpers for integration tests

License

The grit-cli code is GPL-2.0, all other code and crates, including grit-lib are MIT licensed.

About

Reimplementing Git in Rust. Like a boss.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors