Struct rustygit::Repository
source · pub struct Repository { /* private fields */ }
Expand description
A local git repository
Implementations§
source§impl Repository
impl Repository
sourcepub fn new<P: AsRef<Path>>(p: P) -> Repository
pub fn new<P: AsRef<Path>>(p: P) -> Repository
Create a Repository struct from a pre-existing local git repository
sourcepub fn clone<P: AsRef<Path>>(url: GitUrl, p: P) -> Result<Repository>
pub fn clone<P: AsRef<Path>>(url: GitUrl, p: P) -> Result<Repository>
Clone a remote git repository locally
sourcepub fn init<P: AsRef<Path>>(p: P) -> Result<Repository>
pub fn init<P: AsRef<Path>>(p: P) -> Result<Repository>
Initialise a given folder as a git repository
sourcepub fn create_local_branch(&self, branch_name: &BranchName) -> Result<()>
pub fn create_local_branch(&self, branch_name: &BranchName) -> Result<()>
Create and checkout a new local branch
sourcepub fn switch_branch(&self, branch_name: &BranchName) -> Result<()>
pub fn switch_branch(&self, branch_name: &BranchName) -> Result<()>
Checkout the specified branch
sourcepub fn remove(&self, pathspecs: Vec<&str>, force: bool) -> Result<()>
pub fn remove(&self, pathspecs: Vec<&str>, force: bool) -> Result<()>
Remove file contents from the index
sourcepub fn commit_all(&self, message: &str) -> Result<()>
pub fn commit_all(&self, message: &str) -> Result<()>
Commit all staged files
sourcepub fn push_to_upstream(
&self,
upstream: &str,
upstream_branch: &BranchName
) -> Result<()>
pub fn push_to_upstream( &self, upstream: &str, upstream_branch: &BranchName ) -> Result<()>
Push the curent branch to its associated remote, specifying the upstream branch
sourcepub fn fetch_remote(&self, remote: &str) -> Result<()>
pub fn fetch_remote(&self, remote: &str) -> Result<()>
Fetch a remote
sourcepub fn create_branch_from_startpoint(
&self,
branch_name: &BranchName,
startpoint: &str
) -> Result<()>
pub fn create_branch_from_startpoint( &self, branch_name: &BranchName, startpoint: &str ) -> Result<()>
Create a new branch from a start point, such as another local or remote branch
sourcepub fn list_branches(&self) -> Result<Vec<String>>
pub fn list_branches(&self) -> Result<Vec<String>>
List local branches
sourcepub fn list_added(&self) -> Result<Vec<String>>
pub fn list_added(&self) -> Result<Vec<String>>
List files added to staging area
sourcepub fn list_modified(&self) -> Result<Vec<String>>
pub fn list_modified(&self) -> Result<Vec<String>>
List all modified files
sourcepub fn list_untracked(&self) -> Result<Vec<String>>
pub fn list_untracked(&self) -> Result<Vec<String>>
List all untracked files
sourcepub fn list_tracked(&self) -> Result<Vec<String>>
pub fn list_tracked(&self) -> Result<Vec<String>>
List tracked files
sourcepub fn show_remote_uri(&self, remote_name: &str) -> Result<String>
pub fn show_remote_uri(&self, remote_name: &str) -> Result<String>
List all the remote URI for name
sourcepub fn list_remotes(&self) -> Result<Vec<String>>
pub fn list_remotes(&self) -> Result<Vec<String>>
List all the remote URI for name