pub struct Repository { /* private fields */ }Expand description
A handle to a git working tree.
Construction does not spawn git. Repository::open only verifies that
a .git directory (or file, for worktrees/submodules) exists at the path.
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn open(path: impl Into<PathBuf>) -> Result<Self>
pub fn open(path: impl Into<PathBuf>) -> Result<Self>
Open an existing repository at path without running git.
Returns Error::NotARepository if path/.git does not exist.
Sourcepub fn new_unchecked(path: impl Into<PathBuf>) -> Self
pub fn new_unchecked(path: impl Into<PathBuf>) -> Self
Construct a Repository for path without checking that it exists.
Use this when you are about to run init or clone into the path.
Sourcepub async fn init(path: impl Into<PathBuf>) -> Result<Self>
pub async fn init(path: impl Into<PathBuf>) -> Result<Self>
Initialize a new repository at path.
Equivalent to git init <path>. Returns the created Repository.
Sourcepub async fn clone(
url: impl Into<String>,
path: impl Into<PathBuf>,
) -> Result<Self>
pub async fn clone( url: impl Into<String>, path: impl Into<PathBuf>, ) -> Result<Self>
Clone url into path.
Sourcepub fn add(&self) -> AddCommand
pub fn add(&self) -> AddCommand
Build an AddCommand scoped to this repository.
Sourcepub fn commit(&self) -> CommitCommand
pub fn commit(&self) -> CommitCommand
Build a CommitCommand scoped to this repository.
Sourcepub fn status(&self) -> StatusCommand
pub fn status(&self) -> StatusCommand
Build a StatusCommand scoped to this repository.
Sourcepub fn log(&self) -> LogCommand
pub fn log(&self) -> LogCommand
Build a LogCommand scoped to this repository.
Sourcepub fn diff(&self) -> DiffCommand
pub fn diff(&self) -> DiffCommand
Build a DiffCommand scoped to this repository.
Sourcepub fn show(&self) -> ShowCommand
pub fn show(&self) -> ShowCommand
Build a ShowCommand scoped to this repository.
Sourcepub fn branch(&self) -> BranchCommand
pub fn branch(&self) -> BranchCommand
Build a BranchCommand scoped to this repository.
Sourcepub fn checkout(&self) -> CheckoutCommand
pub fn checkout(&self) -> CheckoutCommand
Build a CheckoutCommand scoped to this repository.
Sourcepub fn switch(&self) -> SwitchCommand
pub fn switch(&self) -> SwitchCommand
Build a SwitchCommand scoped to this repository.
Sourcepub fn merge(&self) -> MergeCommand
pub fn merge(&self) -> MergeCommand
Build a MergeCommand scoped to this repository.
Sourcepub fn rebase(&self) -> RebaseCommand
pub fn rebase(&self) -> RebaseCommand
Build a RebaseCommand scoped to this repository.
Sourcepub fn pull(&self) -> PullCommand
pub fn pull(&self) -> PullCommand
Build a PullCommand scoped to this repository.
Sourcepub fn push(&self) -> PushCommand
pub fn push(&self) -> PushCommand
Build a PushCommand scoped to this repository.
Sourcepub fn fetch(&self) -> FetchCommand
pub fn fetch(&self) -> FetchCommand
Build a FetchCommand scoped to this repository.
Sourcepub fn remote(&self, action: RemoteCommand) -> RemoteCommand
pub fn remote(&self, action: RemoteCommand) -> RemoteCommand
Build a RemoteCommand scoped to this repository.
Sourcepub fn tag(&self) -> TagCommand
pub fn tag(&self) -> TagCommand
Build a TagCommand scoped to this repository.
Sourcepub fn stash(&self, action: StashCommand) -> StashCommand
pub fn stash(&self, action: StashCommand) -> StashCommand
Build a StashCommand scoped to this repository.
Sourcepub fn reset(&self) -> ResetCommand
pub fn reset(&self) -> ResetCommand
Build a ResetCommand scoped to this repository.
Sourcepub fn restore(&self) -> RestoreCommand
pub fn restore(&self) -> RestoreCommand
Build a RestoreCommand scoped to this repository.
Sourcepub fn mv(&self, src: impl Into<String>, dst: impl Into<String>) -> MvCommand
pub fn mv(&self, src: impl Into<String>, dst: impl Into<String>) -> MvCommand
Build an MvCommand scoped to this repository.
Sourcepub fn cherry_pick(&self) -> CherryPickCommand
pub fn cherry_pick(&self) -> CherryPickCommand
Build a CherryPickCommand scoped to this repository.
Sourcepub fn grep(&self, pattern: impl Into<String>) -> GrepCommand
pub fn grep(&self, pattern: impl Into<String>) -> GrepCommand
Build a GrepCommand scoped to this repository with the given pattern.
Sourcepub fn config(&self, action: ConfigCommand) -> ConfigCommand
pub fn config(&self, action: ConfigCommand) -> ConfigCommand
Build a ConfigCommand scoped to this repository.
Sourcepub fn reflog(&self, action: ReflogCommand) -> ReflogCommand
pub fn reflog(&self, action: ReflogCommand) -> ReflogCommand
Build a ReflogCommand scoped to this repository.
Sourcepub fn worktree(&self, action: WorktreeCommand) -> WorktreeCommand
pub fn worktree(&self, action: WorktreeCommand) -> WorktreeCommand
Build a WorktreeCommand scoped to this repository.
Sourcepub fn submodule(&self, action: SubmoduleCommand) -> SubmoduleCommand
pub fn submodule(&self, action: SubmoduleCommand) -> SubmoduleCommand
Build a SubmoduleCommand scoped to this repository.
Sourcepub fn bisect(&self, action: BisectCommand) -> BisectCommand
pub fn bisect(&self, action: BisectCommand) -> BisectCommand
Build a BisectCommand scoped to this repository.
Source§impl Repository
impl Repository
Source§impl Repository
impl Repository
Sourcepub fn history(&self) -> HistoryWalk<'_>
Available on crate feature workflow only.
pub fn history(&self) -> HistoryWalk<'_>
workflow only.Walk commit history with a chained-builder filter.
Source§impl Repository
impl Repository
Source§impl Repository
impl Repository
Available on crate feature workflow only.
workflow only.Operations on tags.
Source§impl Repository
impl Repository
Sourcepub fn workflow(&self) -> WorkflowOps<'_>
Available on crate feature workflow only.
pub fn workflow(&self) -> WorkflowOps<'_>
workflow only.High-level workflow compositions.
Trait Implementations§
Source§impl Clone for Repository
impl Clone for Repository
Source§fn clone(&self) -> Repository
fn clone(&self) -> Repository
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more