GitHub gists

Thing just realized… a GitHub gist is its own repository. I’ve treated it as a place to drop notes, mostly, and only edited them via the Github interface. Tonight I tried cloning my gist, and discovered that worked nicely – I had my notes file handily on my local computer. Better, though, I realized I could add more items to my gist… Could set up separate files, all within the same gist context. Each shows up as a separate block containing content.

I next tried to setup a directory, just to see how it’d be conveyed in the interface. Added a directory, added a file within the directory, pushed it up. Went to the interface – nothing changed. Went back and looked: my branch now shows itself as 1 commit ahead of origin/master, and the push of the directory shows that it was rejected by the remote, with a pre-receive hook which indicates that ‘Gist does not support directories’.

Interestingly, gits do support branches. As I listened to my daughters sing some very odd version of Rudolph the Red-nosed Reindeer (who had a very advantageous nose…), I created a ‘weirdChildren’ branch. Git says it pushes up to origin, but the Gists don’t actually show me there’s a branch. I deleted my local branch, and then repulled from remote – got the changes that were unique to that branch.

Now, gists do offer a handy ’embed’ artifact, such as the following: . Whether the gist is secret or not, if that URL is given out, the contents of the Gist can be displayed. However, the URL doesn’t at least directly expose a way to browse the branches of a Gist. In, a branch would be exposed by using username/project/tree/branchName. E.g., colemanserious/gobot/tree/bmp180. That same /tree/branchName suffix doesn’t work on Gist, though: you end up on the GitHub’s well done 404 page. TLDR: if you use a branch for a Gist, you can futz with keeping versions hidden from all view, whether through gist searches or through those who’ve got a copy of your gist’s URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>