After an esteemed colleague sent an article about someone using gists as task lists, I thought it was about time that I publicly profess my love for the gist.

Gists are more or less limited Github repositories. According to GitHub, a gist is:

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.

A gist really excels when you need to share code with someone else. You pick up a lot of the benefits of normal repositories in addition to having it be highly disposable.

Creating a gist is as simple as going to and adding your content.


One of the differences between a gist and a full repository is that a gist that I create cannot be pushed to by you. Of course, you can clone it and commit locally, but when you try to push you'll receive an error. This is regardless of whether the gist is private or public.

If you want to alter another persons gist, you must fork it and then clone & push to a gist that you own.

Clone, Pull, Push

In addition to the web interface, you can interact with gists through the command line.

# Clone a gist via SSH
git clone gists_are_awesome

Now if we change anything in that gist, we can push it back to GitHub.

# Commit the change
git commit -a -m "Updating post."

# Update gist
git push


You can also create branches (and push them to back to Github). I did a little bit of experimenting for this post and it doesn't appear that you can view any branch other than master on the web interface. With that said, those branches are still available when cloning the gist.

# Make the branch
git checkout -b test-branch

# Push it
git push

Further usage

While I like the ubiquity of the web interface, I find having to open a web page an unnecessary step if the right tools are close at hand.


If you use Sublime (2 or 3) another wise move is to grab the gist plugin. Once it is setup, you can create a gist from a file or selected text in 2 keystrokes. The gist URL is copied to your past buffer automatically too. I find this makes sharing code a life saver.

Command line

I highly recommend grabbing the gist Ruby gem. It works both on the command line and in Ruby programs. I'm not a Rubyist - so I use it primarily on the command line.

Do you have any interesting ways of using gists? I'd love to hear about it.