Github gist editing without changing URL

tckmn picture tckmn · Sep 21, 2012 · Viewed 10.6k times · Source

I have a gist with some javascript code in a script tag, like so:

<script src="https://raw.github.com/gist/b25dff23c2c4b4bd425a/f157aa95163311c4b58febb06b49ffd16419f642/images.js"></script>

And I will need to keep editing the JS file on github. However, when you edit a gist it changes the URL of the gist. How do I keep the same URL?

Answer

marclundgren picture marclundgren · Sep 16, 2013

Gist changed the path to this file pattern:

https://gist.github.com/<USER_NAME>/<GIST_ID>/raw/<GIST_REVISION_ID>/<GIST_FILE_NAME>

You will notice that now the top answers' links are 404'ing.

Simply apply this new pattern and voilà!

https://gist.github.com/<USER_NAME>/<GIST_ID>/raw/<GIST_FILE_NAME>

For instance:

https://gist.githubusercontent.com/wesbos/cd16b8b1815825f111a2/raw/lol.js