Reputation: 9648
I have a git url like git@test-git-server:product/test-product.get
which contains 2 branches. I want to get every branch associated with that url.
I tried getting information from location directory cloned from that url but it shows only main branch.
var repo = new Repository(path);
var remotes = repo.Network.Remotes;
foreach (var remote in remotes)
{
Debug.WriteLine("remote: {0}", remote.Name);
}
How to do this using LibGit2Sharp?
Upvotes: 2
Views: 2348
Reputation: 5177
You need to look at the Branches
property in Repository
:
/// <summary>
/// Lookup and enumerate branches in the repository.
/// </summary>
public BranchCollection Branches
Source: Line 283 in here: https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs
Upvotes: 3