https://github.com/olback/lgc-rs
https://github.com/olback/lgc-rs
author commit git git-hash git2-rs library rust
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/olback/lgc-rs
- Owner: olback
- Created: 2019-07-17T01:21:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-22T20:26:50.000Z (over 3 years ago)
- Last Synced: 2024-12-10T11:36:31.983Z (11 months ago)
- Topics: author, commit, git, git-hash, git2-rs, library, rust
- Language: Rust
- Homepage: https://crates.io/crates/last-git-commit
- Size: 33.2 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LastGitCommit-rs
A simple wrapper arround [`git2-rs`](https://github.com/rust-lang/git2-rs) to easily get info about the last commit. Useful when you want to show the last commit message or the current git hash.
[](https://circleci.com/gh/olback/lgc-rs) [](https://docs.rs/last-git-commit) [](https://crates.io/crates/last-git-commit)
### Simple Git Hash Example
```rust
use last_git_commit::LastGitCommit;
let lgc = LastGitCommit::new().build().unwrap();
let long = lgc.id().long();
let short = lgc.id().short();
let range = lgc.id().range(0..3).unwrap();
println!("Long: {}", long); // "c4f94258c12b8905f3d57f879ae1171ce367cd29"
println!("Short: {}", short); // "c4f9425"
println!("Range: {}", range); // "c4f"
```
#### Please see the [documentation](https://docs.rs/last-git-commit) and [examples](https://github.com/olback/lgc-rs/tree/master/examples).