是否有最新版本的gist文件的永久链接?

WoJ*_*WoJ 16 gist github permalinks

我创建了一个包含两个文件的要点,我希望将其原始版本用作查询其内容的应用程序的参考.这些内容将在GitHub上更新.

然而,我发现文件的URL随着每个版本的要点而变化.是否有一个固定链接指向文件中的最新版本的文件?

小智 27

原始网址遵循以下模式:

https://gist.githubusercontent.com/[gist username]/[gist ID]/raw/[gist commit ID]/[file name]
Run Code Online (Sandbox Code Playgroud)

要查看最新版本,只需删除该[gist commit ID]部分:

https://gist.githubusercontent.com/[gist username]/[gist ID]/raw/[file name]
Run Code Online (Sandbox Code Playgroud)

例如

https://gist.githubusercontent.com/mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca/raw/user.js
Run Code Online (Sandbox Code Playgroud)

请记住,端点已缓存,因此您的更新可能会稍有延迟.

  • 您知道使用最新更改更新缓存版本需要多长时间吗? (2认同)
  • FWIW看起来你可以通过将查询字符串附加到URL来缓存 - 例如`https://gist.githubusercontent.com/mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca/raw/user.js?cachebust = dkjflskjfldkf` (2认同)
  • 实际上,似乎还需要删除末尾部分,否则您可能会因某种原因获得旧版本的文件。所以它是:https://gist.githubusercontent.com/[gist username]/[gist ID]/raw / (2认同)