Struct git2::Branch [] [src]

pub struct Branch<'repo> {
    // some fields omitted
}

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 unwrap methods.

Methods

impl<'repo> Branch<'repo>
[src]

fn wrap(reference: Reference) -> Branch

Creates a new branch from a reference

fn get(&self) -> &Reference<'repo>

Gain access to the reference that is this branch

fn into_reference(self) -> Reference<'repo>

Take ownership of the underlying reference.

fn delete(&mut self) -> Result<()Error>

Delete an existing branch reference.

fn is_head(&self) -> bool

Determine if the current local branch is pointed at by HEAD.

fn rename(&mut self, new_branch_name: &str, force: bool) -> Result<Branch<'repo>, Error>

Move/rename an existing local branch reference.

fn name(&self) -> Result<Option<&str>, Error>

Return the name of the given local or remote branch.

May return Ok(None) if the name is not valid utf-8.

fn name_bytes(&self) -> Result<&[u8]Error>

Return the name of the given local or remote branch.

fn upstream<'a>(&'a self) -> Result<Branch<'a>, Error>

Return the reference supporting the remote tracking branch, given a local branch reference.

fn set_upstream(&mut self, upstream_name: Option<&str>) -> Result<()Error>

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.