Crates.io | mhgit |
lib.rs | mhgit |
version | 0.1.0 |
source | src |
created_at | 2020-05-10 11:42:59.835406 |
updated_at | 2020-05-10 11:42:59.835406 |
description | MHgit is a simple git library for interracting with git repositories. |
homepage | |
repository | https://github.com/MHmorgan/mhgit |
max_upload_size | |
id | 239607 |
size | 1,768,266 |
MHgit is a simple git library for interracting with git repositories. Provides an idiomatic and easy way of dealing with git repos.
Requires git to be installed on the system.
add
clone
commit
init
notes
pull
push
remote
status
stash
tag
extern crate mhgit;
use mhgit::{CommandOptions, Repository};
use mhgit::commands::{PushOptions, RemoteOptions};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let repo = Repository::at("/home/mh/awesomeness")?
.init()?
.add()?
.commit("Initial commit")?;
RemoteOptions::add()
.master("master")
.name("upstream")
.url("https://web.com/myrepo.git")
.run(&repo)?;
PushOptions::new()
.set_upstream(true)
.remote("origin")
.refspec("master")
.run(&repo)?;
Ok(())
}