gist.github.com has a great feature where you can embed the current version of a file in a blog via a <script/> tag.

However, I can't seem to embed an older revision, or the current atomic revision in such a way, that further commits won't update what's embedded by the embed tag. Is this possible?

  • So you want to post static content that is highlighted basically.
    – phwd
    Commented Jan 15, 2012 at 19:58
  • @phwd Well, the idea is that I would have a blog article about a specific revision of the file. In the future I might have a different revision, which I might or might not embed anywhere. Now imagine if this embed functionality was part of regular github repos. Maybe I wanted to embed a particular commit in a blog (or bug tracking system) Commented Jan 15, 2012 at 22:57

2 Answers 2


Just add .js to the end of the URL like this: https://gist.github.com/1522901/0f74d53b18060f6292db9dc4d6c1922f72aa2aaf.js

  • no longer works Commented Aug 2, 2019 at 21:31
  • Works for me still, to get the very first revision of the above Gist (with an ugly eval() that is removed in later revisions) you can include this js: gist.github.com/aconrad/1522901/…
    – asontu
    Commented May 9, 2022 at 14:35

Unless Github makes this possible (perhaps with a feature request/service hook), one easy way would be to simply display the contents of the gist using its complete url along with the commit hash, such as https://gist.github.com/1522901/0f74d53b18060f6292db9dc4d6c1922f72aa2aaf, and then just use some third party code highlighting library for displaying it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.