17 个版本
0.5.0 | 2023年2月16日 |
---|---|
0.4.4 | 2022年9月12日 |
0.4.3 | 2022年1月16日 |
0.4.2 | 2020年8月23日 |
0.1.0 | 2019年11月26日 |
#650 在 开发工具 中
183 每月下载
用于 5 个包(4 直接使用)
17KB
380 代码行
Rusty-git
一个用于与 git
交互的高级库
用法
将以下内容添加到您的 cargo.toml
[dependencies]
rustygit = "0.4"
use rustygit;
let repo = rustygit::Repository::new(".");
let branches = repo.list_branches().unwrap();
println!("branches:");
for branch in branches {
println!("{}", branch);
}
与 git2-rs 的比较
git2-rs 是一个成熟且功能丰富的 Git 库,与这个库不同,它不需要 git
在用户的 $PATH 上。
然而,这个库相对于 git2-rs 有一些优势
- 纯 Rust 而不是 C++ 库的绑定,使得交叉编译更容易。
- 在 Windows 上与 git 的 SSH 代理一起工作(git2-rs 所使用的 libssh 目前无法做到,使得在 Windows 上使用 SSH 不可能)
- 提供更高层次的 API,需要更少的 Git 内部知识
依赖关系
~2.3–4MB
~71K SLoC