Noggog
Noggog

Reputation: 61

Retrieve a Remote's Default Branch

Within the scope of LibGit2Sharp, is there a way to retrieve which branch is the default branch for any given remote? Eg, what branch would be checked out if I were to do a fresh clone?

A git.exe equivalent might be:

git remote show REMOTE_REPO_NAME | grep 'HEAD branch' | cut -d' ' -f5

I can't seem to find an equivalent API call from within LibGit2Sharp

Upvotes: 1

Views: 474

Answers (1)

Nathan Mills
Nathan Mills

Reputation: 2279

No, there's no way to get that information from libgit2sharp as it doesn't wrap the git_remote_default_branch function from libgit2.

There is an open issue on GitHub (#1796) about adding the git_remote_default_branch function to libgit2sharp. I tried searching the libgit2sharp repository for git_remote_default_branch but that issue is the only result.

Upvotes: 3

Related Questions