是否有一个稳定的URL可以始终在github中获取默认分支? [英] Is there a stable url to always get the default branch in github?

查看:37
本文介绍了是否有一个稳定的URL可以始终在github中获取默认分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,在大多数情况下,您可以将 blob/master/添加到github url中以获取原始文件,即 https://github.com/jacoco/jbang-catalog/blob/master/jbang-catalog.json`

In past you could in most cases just add blob/master/ to a github url get the raw file, i.e. https://github.com/jacoco/jbang-catalog/blob/master/jbang-catalog.json`

现在有使用 master 的旧仓库,但是使用 main 的新仓库在新仓库上不起作用.

Now with old repos using master but new using main that trick don't work on new repos.

有没有一种方法可以避免必须调用rest api来找到默认分支main?

Is there a way to avoid having to do a call to the rest api to find default branch main ?

blob/@ default/之类的魔术标记还是类似的标记?

like a magic marker like blob/@default/ or similar ?

推荐答案

解决方案是使用HEAD.无论其名称是什么,该符号名称都会为您提供默认分支的提示.

The solution is to use HEAD. That symbolic name will give you tip of the default branch no matter what its name is.

这篇关于是否有一个稳定的URL可以始终在github中获取默认分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆