jsdelivr icon indicating copy to clipboard operation
jsdelivr copied to clipboard

Feature: github link should use default branch, not master branch

Open styfle opened this issue 4 years ago • 5 comments

Does the github link without a branch specified, for example https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.js, use the default branch or is hardcoded to the master branch?

styfle avatar Aug 17 '20 03:08 styfle

master regardless of the GitHub settings

MartinKolarik avatar Aug 17 '20 05:08 MartinKolarik

I see.

Then consider this a feature request to change it to the repo's default branch 🙂

Also note that GitHub is going to be changing the default branch for new repos in the future: https://github.com/github/renaming

styfle avatar Aug 17 '20 14:08 styfle

I'll keep this open to consider later but in the end we may just decide to recommend using explicit branch names. Resolving this dynamically per repository is probably something we would like to avoid.

MartinKolarik avatar Aug 17 '20 15:08 MartinKolarik

Today I found that GitHub supports @HEAD references, which seem to point to the default branch, e.g. https://github.com/ractivejs/ractive/blob/HEAD/package.json.

However, I couldn't find anything at all in GitHub docs about it. If anyone finds a resource that confirms this is intended behavior that is safe to rely on, it'll definitely help.

MartinKolarik avatar Sep 15 '20 16:09 MartinKolarik

Relevent info: https://stackoverflow.com/questions/64726262/is-there-a-stable-url-to-always-get-the-default-branch-in-github

BirkhoffLee avatar Feb 13 '21 08:02 BirkhoffLee