gitoxide README

The project's README from github.com/GitoxideLabs/gitoxide. As one markdown file: README.md.

CI Crates.io

gitoxide is an implementation of git written in Rust for developing future-proof applications which strive for correctness and performance while providing a pleasant and unsurprising developer experience.

There are two primary ways to use gitoxide:

  1. As Rust library: Use the gix crate as a Cargo dependency for API access.
  2. As command-line tool: The gix binary as development tool to help testing the API in real repositories, and the ein binary with workflow-enhancing tools. Both binaries may forever be unstable, do not rely on them in scripts.

asciicast

Development Status

The command-line tools as well as the status of each crate is described in the crate status document.

For use in applications, look for the gix crate, which serves as entrypoint to the functionality provided by various lower-level plumbing crates like gix-config.

Feature Discovery

Can gix do what I need it to do?

The above can be hard to answer and this paragraph is here to help with feature discovery.

Look at crate-status.md for a rather exhaustive document that contains both implemented and planned features.

Further, the gix crate documentation with the git2 search term helps to find all currently known git2 equivalent method calls. Please note that this list is definitely not exhaustive yet, but might help if you are coming from git2.

What follows is a high-level list of features and those which are planned:

Crates

Follow linked crate name for detailed status. Please note that all crates follow semver as well as the stability guide.

Production Grade

Stabilization Candidates

Crates that seem feature complete and need to see some more use before they can be released as 1.0. Documentation is complete and was reviewed at least once.

Initial Development

These crates may be missing some features and thus are somewhat incomplete, but what's there is usable to some extent.

Stress Testing

Stability and MSRV

Our stability guide helps to judge how much churn can be expected when depending on crates in this workspace.

Installation

Download a Binary Release

Using cargo binstall, one is able to fetch binary releases. You can install it via cargo install cargo-binstall, assuming the rust toolchain is present.

Then install gitoxide with cargo binstall gitoxide.

See the releases section for manual installation and various alternative builds that are slimmer or smaller, depending on your needs, for Linux, MacOS and Windows.

Install with Homebrew

For macOS and Linux, gitoxide can be installed from Homebrew:

brew install gitoxide

Download from Arch Linux repository

For Arch Linux you can download gitoxide from community repository:

pacman -S gitoxide

Download from Exherbo Linux Rust repository

For Exherbo Linux you can download gitoxide from the Rust repository:

cave resolve -x repository/rust
cave resolve -x gitoxide

From Source via Cargo

cargo is the Rust package manager which can easily be obtained through rustup. With it, you can build your own binary effortlessly and for your particular CPU for additional performance gains.

The minimum supported Rust version is documented in the Cargo package, the latest stable one will work as well.

There are various build configurations, all of them are documented here. The documentation should also be useful for packagers who need to tune external dependencies.

# A way to install `gitoxide` with just Rust and a C compiler installed.
# If there are problems with SSL certificates during clones, try to omit `--locked`.
cargo install gitoxide --locked --no-default-features --features max-pure

# The default installation, 'max', is the fastest, but also needs `cmake` to build successfully.
# Installing it is platform-dependent.
cargo install gitoxide

# For smaller binaries and even faster build times that are traded for a less fancy CLI implementation,
# use the `lean` feature.
cargo install gitoxide --locked --no-default-features --features lean

The following installs the latest unpublished max release directly from git:

cargo install --git https://github.com/GitoxideLabs/gitoxide gitoxide

How to deal with build failures

On some platforms, installation may fail due to lack of tools required by C toolchains. This can generally be avoided by installation with:

cargo install gitoxide --no-default-features --features max-pure

What follows is a list of known failures.

Using Docker

Some CI/CD pipelines leverage repository cloning. Below is a copy-paste-able example to build docker images for such workflows. As no official image exists (at this time), an image must first be built.

[!NOTE] The dockerfile isn't continuously tested as it costs too much time and thus might already be broken. PRs are welcome.

Building the most compatible base image

docker build -f etc/docker/Dockerfile.alpine -t gitoxide:latest --compress . --target=pipeline

Basic usage in a Pipeline

For example, if a Dockerfile currently uses something like RUN git clone https://github.com/GitoxideLabs/gitoxide, first build the image:

docker build -f etc/docker/Dockerfile.alpine -t gitoxide:latest --compress .

Then copy the binaries into your image and replace the git directive with a gix equivalent.

COPY --from gitoxide:latest /bin/gix /usr/local/bin/
COPY --from gitoxide:latest /bin/ein /usr/local/bin/

RUN /usr/local/bin/gix clone --depth 1 https://github.com/GitoxideLabs/gitoxide gitoxide

Usage

Once installed, there are two binaries:

Project Goals

Project goals can change over time as we learn more, and they can be challenged.

Non-Goals

Project non-goals can change over time as we learn more, and they can be challenged.

Contributions

If what you have seen so far sparked your interest to contribute, then let us say: We are happy to have you and help you to get started. What's paricularly welcome is the discovery of deviations from Git, or the prodding and probing to find bugs and other forms of undesirable behaviour.

Please read the contribution guide before starting. It covers when prior discussion is required and how to prepare a submission.

Getting started with Video Tutorials

Other Media

Roadmap

Features for 1.0

Provide a CLI to for the most basic user journey:

Ideas for Examples

Ideas for Spin-Offs

Shortcomings & Limitations

Please take a look at the SHORTCOMINGS.md file for details.

Credits

🙏 Special Thanks 🙏

At least for now this section is exclusive to highlight the incredible support that Josh Triplett has provided to me in the form of advice, sponsorship and countless other benefits that were incredibly meaningful. Going full time with gitoxide would hardly have been feasible without his involvement, and I couldn't be more grateful 😌.

License

This project is licensed under either of

at your option.

Fun facts

gitoxide (GitoxideLabs/gitoxide)

Searching Database…

这是什么?gitoxide(gix)是用纯 Rust 实现的 Git,既提供库,也提供一组用于操作 Git 仓库的命令行工具。
它是库、命令行工具,还是两者都是?两者都是:gix crate 是供库使用的 Cargo 依赖,而 gix 和 ein 这两个可执行文件则是用于日常 Git 工作流和底层命令的命令行工具。
我该如何安装命令行工具?可以用 cargo-binstall 安装预编译好的二进制文件(cargo install cargo-binstall && cargo binstall gitoxide),也可以通过 Homebrew 安装,或者使用 rustup 提供的 Rust 工具链,借助 cargo 从源码构建。
构建时除了 Rust,还需要别的东西吗?需要 Rust 工具链(通过 rustup 安装)和 cargo;在 Fedora 等部分平台上,还需要安装 perl,OpenSSL 才能正确构建。
它现在支持所有 Git 功能了吗,比如 push 或 rebase?还没有。push、合并提交、rebase、reset 和钩子仍未实现,而且两个可执行文件可能仍不够稳定,因此不应在脚本中依赖它们。
这个项目面向哪些人?面向开发 Git 相关工具的 Rust 开发者,他们希望找到比绑定 libgit2 或使用 GitPython 更安全、更符合 Rust 惯用写法的替代方案;也面向希望用一个快速命令行工具完成常见 Git 操作的人。
它能在 Windows 上运行,也能在 Linux 和 macOS 上运行吗?可以。Windows 与 Linux、macOS 一样是一等支持的平台,三者都提供二进制发布版和 Homebrew 软件包,并且 Windows 也在 CI 中测试。
为什么要另写一个 Git 实现,而不是直接封装 libgit2?该项目旨在利用 Rust 的类型系统防止误用,保证磁盘上数据的一致性,并支持安全的并发读写,最终成为比 libgit2 和 GitPython 性能更好、更符合 Rust 惯用写法的替代方案。
这个项目不打算做什么?它不打算完美复刻每一个 git 命令,也不打算破坏磁盘格式的兼容性,更不会在所有地方都使用异步 IO,因为大多数 Git 操作依赖内存映射 IO 和受 CPU 限制的解压缩,而非异步方式。
gix 和 ein 两个可执行文件有什么区别?gix 提供用于特定场景的底层命令,以及用真实仓库验证库的功能;ein 则提供更高层、对用户更友好的命令,适合日常使用。
工作区中各个 crate 的稳定性如何?crate 按稳定性分级:从可用于生产环境的(如 gix-lock、gix-tempfile),到待稳定的候选 crate,再到非常早期、仍处于构想阶段的 crate(如 gix-tui 和 gix-rebase)。
What are similar projects?git-bug, git, gitui, fd, jj, crab, epiq, git-filter-repo
Size
125.9 MB
Stars
12K
Age
8y
Commits · 90 Days