Struct git2::Branch [−][src]
A structure to represent a git branch
A branch is currently just a wrapper to an underlying Reference
. The
reference can be accessed through the get
and into_reference
methods.
Implementations
impl<'repo> Branch<'repo>
[src]
pub fn wrap(reference: Reference<'_>) -> Branch<'_>
[src]
Creates Branch type from a Reference
pub fn get(&self) -> &Reference<'repo>
[src]
Gain access to the reference that is this branch
pub fn into_reference(self) -> Reference<'repo>
[src]
Take ownership of the underlying reference.
pub fn delete(&mut self) -> Result<(), Error>
[src]
Delete an existing branch reference.
pub fn is_head(&self) -> bool
[src]
Determine if the current local branch is pointed at by HEAD.
pub fn rename(
&mut self,
new_branch_name: &str,
force: bool
) -> Result<Branch<'repo>, Error>
[src]
&mut self,
new_branch_name: &str,
force: bool
) -> Result<Branch<'repo>, Error>
Move/rename an existing local branch reference.
pub fn name(&self) -> Result<Option<&str>, Error>
[src]
Return the name of the given local or remote branch.
May return Ok(None)
if the name is not valid utf-8.
pub fn name_bytes(&self) -> Result<&[u8], Error>
[src]
Return the name of the given local or remote branch.
pub fn upstream(&self) -> Result<Branch<'repo>, Error>
[src]
Return the reference supporting the remote tracking branch, given a local branch reference.
pub fn set_upstream(&mut self, upstream_name: Option<&str>) -> Result<(), Error>
[src]
Set the upstream configuration for a given local branch.
If None
is specified, then the upstream branch is unset. The name
provided is the name of the branch to set as upstream.
Auto Trait Implementations
impl<'repo> RefUnwindSafe for Branch<'repo>
impl<'repo> !Send for Branch<'repo>
impl<'repo> !Sync for Branch<'repo>
impl<'repo> Unpin for Branch<'repo>
impl<'repo> UnwindSafe for Branch<'repo>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,