c# - 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
解决方案
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.
推荐阅读
- python - 用于熵计算的numpy数组划分
- java - MultiLine Listview 随机排序
- php - Codeigniter count_all_results 然后得到返回错误号 1066
- multithreading - TWorkStealingQueue 的目的是什么以及如何使用它?
- magento-1.9 - 起订金额属性名称 > 包邮 > 销售 > 发货方式 > 配置 > 系统
- javascript - 将事件添加到添加的动态 DOM 按钮 - jQuery
- sql - spark sql:计算具有不同谓词的出现次数
- git - Visual Studio 代码资源管理器中缺少 GIT 状态
- c# - 如何将参数添加到我在 Xamarin 中定义的命令?
- java - Struts 错误自动将字符串转换为垃圾值