What is GitHub Gist? (Explained)
GitHub Gists provide lightweight version-controlled storage for snippets, documents, data, multiple related files, embedded code, and simple web pages.
Transcript 5 topics
Creating gists on GitHub
0:00To start from GitHub, click on the plus sign on the top right and choose new guest. New guest. Hello world, my name is Michael Jolley and I'm the bold bearded builder. Let's talk about GitHub GISTs. Maybe it's new to you, maybe you've heard of it but never used it.
Maybe you use it and you just wanna find new ways to use it. Let's cover it all. Before we get too deep, let me remind you that if you love learning new things, hanging out with our developers and just having a good time, we're live on Twitch three days a week, Tuesday through Thursdays at two Eastern seven UTC. You can find us at twitch. Tvbaldbeardedbuilder and we'd love to have you hang out with us.
Gist basics
0:43Okay, so what is a GitHub gist? It's like the little brother to a GitHub repository. It doesn't have things like issues and pull requests or projects and actions or that kind of fluff, but it does have that Git goodness of version control, comments, and the ability to market private or public. One of the cool things about gist is that you don't have to have an account to use it. But if you do use an account, you can find all your gist at gist.github.com slash your username.
Before we get into the how tos of how to manage your GIS, let's talk about some ways that you might wanna use them. There are a ton of use cases, but if you are creating code snippets or embedding code into your website or blog, maybe tracking data in markdown, keeping up with a file or even hosting single web pages. So how do we use it? I'm gonna first assume that you have a GitHub account.
If you don't, go create that and then come back, I'll wait. All right, let's continue.
Managing gist files
1:49To start, go to github.com and press that plus sign in the top menu, then choose new gist or go to gist.github.com and just press the plus sign. On that new gist screen, you can provide an optional description, a file name, and I do recommend adding extensions here, and then the contents of whatever you wanna save. There's also some nice formatting things like tab versus spaces, but I won't start that war, and word wrapping. Also, when you create a new gist, you can choose whether to mark it as private or public. But don't worry, you can always change this later.
One thing I wanna point out because I don't see it a lot is that you can have multiple files within the same gist. There's a little button down there that lets you add additional files with file names and content. So you could imagine an example where you have an HTML, CSS and JavaScript file all contained together. Editing and deleting are pretty straightforward. GitHub provides an edit and delete button at the top of your gist where you can do that pretty simply.
I love the fact that just are so similar to repositories. Subscribing, starring, downloading zip files, commenting. It's all the same as repositories, which makes it really easy to pick up and use if you're familiar with GitHub. GitHub also makes it really easy to embed a gist into your website by providing the embed code right there on the page.
You can just press a button to copy that code, paste it wherever you need it. I mentioned earlier that all your revisions are tracked just like normal files in a GitHub repo.
Revision history and embeds
3:22You just press that revision history and you can see all the changes with a rich diff. So now that we kind of know what they are and how to manage them, why would we want to? We mentioned some use cases earlier. Let's go into some detail to show you how those are useful. Definitely the most common use case is code snippets or embedding code into websites.
They make it really easy with that embed code and some services like Medium even provide that snippet experience out of the box. I use just all the time for keeping up with various data points and documents that I need to keep track of. What kind of data? Well, for one, information about the talks that I give. For each talk that I give, I have to keep track of some basic information like a brief abstract or description, maybe some points that I need to share with conference or meetup organizers.
I have to pull this data anytime I submit a new talk to a conference or meetup and keeping it in a gist allows me to make changes with revision history and improve on it as talks get accepted or declined. I'll also keep another gist to keep track of the conferences and meetups that I submit talks to. I keep track of what talk, what conference, what dates, whether it was accepted or declined, and I can often reference that to decide what conferences or meetups I wanna speak at next year. Next up, how about serving a quick webpage?
If you create a gist and name it index. Html, you can go to bl.ockxorg and you can learn more about how to use their service to serve that gist.
Hosting a quick webpage
4:47It's not really scalable, it's not something you're gonna wanna build on, but if you need a page up really quick, it's super simple. GitHub GIST are really cool. And there's a great Versus Code extension that makes it really easy to manage them from within Versus Code. We did a highlight video on that recently, so go check that out if you wanna learn more about it. How do you use Gabb Jits?
I love learning new ways to improve what I'm doing. And if you love getting new productivity tips or learning about cool extensions or developer technologies, be sure to subscribe and hit the bell to know when we produce new videos. Also, I would really appreciate it if you would hit that like button if you enjoyed today's video. Thanks so much for hanging out. Until next time.
Sign in to join in. Reading needs nothing.