Skip to content
nulltoken edited this page May 25, 2011 · 14 revisions

git-branch

Listing branches

Displaying local branches while highlighting the current branch with an asterisk

Git

$ git branch

LibGit2Sharp

using (var repo = new Repository("path/to/your/repo"))
{
    foreach(Branch b in repo.Branches.Where(b => !b.IsRemote))
    {
        Console.WriteLine(string.Format("{0}{1}", b.IsCurrentRepositoryHead ? "*" : " ", b.Name));
    }
}
Clone this wiki locally