Search code examples
c#gitngit

How to get list of tags with NGit


I'm using NGit and I want to get a list of all tags of my current working branch. So I created a NGit instance like this:

var git = Git.Open("c:\\temp\\projectx");

Now I want to get a list of all tags in the git archive, but how? There is no command like: var refs =Git.TagList().Call();

I would expect that there is a something like BranchList()... var refs = Git.BranchList().SetListMode(ListBranchCommand.ListMode.ALL).Call();

Any ideas?

Thanks!


Solution

  • Try this

    var tags = Git.Open("c:\\temp\\projectx").GetRepository().GetTags();
    

    where tags is IDictionary<string,Ref>