Given a specific reference (a tag in this case) how can you list the branches that contain that commit in git2go? Similar to git branch --contains <commit>
.
如何在git2go(libgit2)中列出包含给定提交的分支?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- duanqu9279 2015-07-30 12:40关注
The question here, graph-wise is "how do I know if A is an ancestor of B?" (repeated a few times for each branch which you want to be B). The only way to answer that is to walk down the history graph starting at B and check if you find A.
You can do this in a few ways, but the most efficient is generally going to be to reduce the question to the equivalent "is A a merge-base of A and B?". You can ask this question in git2go via
Repository.MergeBase()
. This will return the best merge-base between the two commits you give it. In the case where you want one of the commits to be the merge base, this should always provide the right answer, even though it cuts the answer down to a single merge base.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥30 YOLO检测微调结果p为1
- ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
- ¥15 DS18B20内部ADC模数转换器
- ¥15 做个有关计算的小程序
- ¥15 MPI读取tif文件无法正常给各进程分配路径
- ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
- ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
- ¥15 setInterval 页面闪烁,怎么解决
- ¥15 如何让企业微信机器人实现消息汇总整合
- ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题