2014-02-24 41 views
1

我有一個像[email protected]:product/test-product.get這樣的git url,它包含2個分支。我想讓每個分支與該網址相關聯。如何使用LibGit2Sharp獲取分支?

我試圖從該網址克隆的位置目錄獲取信息,但它只顯示主分支。

var repo = new Repository(path); 

var remotes = repo.Network.Remotes; 

foreach (var remote in remotes) 
{ 
    Debug.WriteLine("remote: {0}", remote.Name); 
} 

如何使用LibGit2Sharp來做到這一點?

回答

2

你需要看看Branches財產Repository

/// <summary> 
/// Lookup and enumerate branches in the repository. 
/// </summary> 
public BranchCollection Branches 

來源:此處線路283:https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Repository.cs

+0

問題是,當我創建git的一個新的分支,我不能得到新的來自分支機構屬性的分支信息。 – Anonymous

+0

我也無法從git url和http和ssh獲取分支。如果你知道如何去做,請幫助我。 – Anonymous

+0

@匿名:你看到什麼錯誤? – yasouser

相關問題