What is the purpose of gist and how is it different from regular code sharing/maintaining using GitHub?
-
225How is it offtopic? I consider both gist and github *software tools commonly used by programmers*. This question fits in perfectly. – golem Jun 17 '15 at 19:12
-
82I voted to reopen this question as it is useful and relates to software tools commonly used by programmers. The "*About Gists*" page on Github contains some useful info, but does not answer the question about the key differences and under which circumstances a user might prefer one over the other. I would personally like to see more detailed answers to this question. – Simon East Aug 16 '16 at 04:17
-
10An important difference i don't see mentioned anywhere is that Gist dropped support for directories. I only noticed it when i ran into this issue: http://stackoverflow.com/a/27677649/5343341 – Robotic-Brain Sep 06 '16 at 18:27
-
2What I'd find most helpful is learning what _gists_ can do that _Github Repositories_ cannot. If the answer is _"Nothing."_ then I'll just carry on using _Github Repositories_ for everything. – Rounin Feb 26 '20 at 13:25
10 Answers
GitHub is the entire site. Gists are a particular service offered on that site, namely code snippets akin to pastebin. However, everything is driven by git revision control, so gists also have complete revision histories.

- 464,522
- 92
- 875
- 1,084
-
243So what's the difference between a Gist and a Repository? What are the advantages and disadvantages of each? (I believe this was what the OP intended to ask) – chharvey Jul 03 '13 at 06:03
-
73@TestSubject528491: A repository is for user-created files. A gist is for a piece of code (usually unconnected to other code), like for discussing or giving examples. – Kerrek SB Jul 03 '13 at 08:01
-
23@TestSubject528491 As Kerrek says, Gists are essentially Githubs equivalent of Pastebin. – Phill Healey Dec 08 '13 at 19:17
-
8
-
47@Pacerier: Of course you could. But then you need to manage files yourself, clone the repository, push commits and all that. Gists let you edit the text directly in the browser and there are no files you need to manage. As I said, same underlying version control mechanism, but addressing different need. – Kerrek SB Jun 04 '15 at 09:18
-
3*"But then you need to manage files yourself, clone the repository, push commits and all that. Gists let you edit the text directly in the browser."* — well actually Github allows you to do all that too, in your browser, so that's not really a difference. And Gists also can support multiple files. – Simon East Aug 16 '16 at 04:12
-
31@SimonEast the main differences between github and gists are in terms of number of features and user interface: one is designed with a great number of features and flexibility in mind, which is a good fit for both small and very big projects, while gists are only a good fit for very small projects. For example, gists do support multi-files, but the interface is very simple, and they're limited in features, so they don't even have a file browser, nor issues, pull requests or wiki. If you dont need to have that, gists are very nice and more discrete. Like the comments, instead of answers, in SO. – joseLuís Feb 03 '17 at 22:11
-
4GitHub is good for proper projects. On the other hand, Gists are mainly small code snippets which you would like to post for no reason, embed on other sites, make private and for quick personal reference. – Timothy Quang Phuc Nguyen Mar 02 '17 at 09:48
-
3@joseLuís Could you make it into a real answer? Like you said, don't use SO comments for a fully featured answer :) – Qwerty Nov 02 '17 at 08:26
-
@KerrekSB isn't anything in github user-created (or similarly, modified, after being cloned) ? Also, discussing code isn't better in stackoverflow instead where we have markdown for inserting user defined code ? So why one would first write a code into a gist then copy / paste it into stackoveflow instead of writing it directly right here? – Eve Nov 25 '21 at 13:55
-
Gists have revision histories but not commit messages. A proper repo is better suited for anything beyond trivial revisions. – qwr Sep 07 '22 at 21:13
My personal view of Gist and GitHub:
Gist: Gist is a simple way to share code snippets and pastes with others. It is used when you need to share a sample piece of code or technique with your co-workers or friends.
And
GitHub GitHub, on the other hand, provides a platform to share an entire project as a repo among a team (private repo) or to the whole world (public repo).
Both will log version details.

- 332
- 3
- 5

- 2,166
- 1
- 13
- 15
-
2
-
9@Chetan example of [a gist](https://gist.github.com/vrillusions/9538779) (note how it's just a single file, not really in need of any supporting files, no one is ever going to make tickets, etc (as an aside that config is probably old so don't use it)). example of [a project](https://github.com/vrillusions/iptables-init) it's pretty small but someone could open a ticket with suggestions and easy to remember address vs gist's url – vrillusions Oct 28 '16 at 23:23
The main differences between GitHub and gists are in terms of the number of features and user interface:
One is designed with a great number of features and flexibility in mind, which is a good fit for both small and very big projects, while gists are only a good fit for very small projects.
For example, gists do support multi-files, but the interface is very simple, and they're limited in features, so they don't even have a file browser, nor issues, pull requests or wiki. If you don't need to have that, gists are very nice and more discrete. Like the comments, instead of answers, in SO.
Note: Thanks to @Qwerty for the suggestion of making my comment a real answer.

- 109
- 1
- 2
- 11

- 1,090
- 9
- 10
-
10Also "Gists are for files, repositories are for directories", https://twitter.com/pavelrepin/status/297473901884223488 – Qwerty Nov 06 '17 at 10:11
-
13In my opinion this is the only real answer to the question to date. Every other answer just restates the purpose of the sites without explaining what features and differences enable that purpose. It's like saying "This car is meant to drive to the beach, but this car is meant to drive to work", without mentioning that the beach car is a convertible. – DavidS Jan 24 '18 at 23:23
-
Agree with @DavidS best answer here. So if I remove the buzzword "share" it tells me it is also great for saving small scripts that I use, like for example the python script i just made to create a trivial YAML file foe me, no project needed just this one file that i might need to find again in 5 month maybe on another computer. Or do I miss something important here? – Otzen Jan 15 '22 at 16:43
My personal understanding or to say my personal usage of Gist and GitHub is:
- GitHub
A big project work. If you want to build website, develop mobile or web application, or do your assignment with your teammates, of course use GitHub.
- Gist
More like a memo. For example, you can write the implementation of a small feature and share it to your blog, or write down what you think about the project and share it with your teammates. Just like what the above answers said, Gist is used for more like code snippet thing. So normally if you work on a project, you use GitHub.

- 332
- 3
- 5

- 319
- 3
- 3
-
6The "memo" analogy cleared this for me--otherwise, I'd have to ask "what is a pastebin?" – YCode Dec 30 '17 at 04:05
You can access Gist by visiting the following url gist.github.com. Alternatively you can access it from within your Github account (after logging in) as shown in the picture below:
Github: A hosting service that houses a web-based git repository. It includes all the fucntionality of git with additional features added in.
Gist: Is an additional feature added to github to allow the sharing of code snippets, notes, to do lists and more. You can save your Gists as secret or public. Secret Gists are hidden from search engines but visible to anyone you share the url with.
For example. If you wanted to write a private to-do list. You could write one using Github Markdown as follows:
NB: It is important to preserve the whitespace as shown above between the dash and brackets. It is also important that you save the file with the extension .md because we want the markdown to format properly. Remember to save this Gist as secret if you do not want others to see it.
The end result looks like the image below. The checkboxes are clickable because we saved this Gist with the extension .md

- 11,272
- 7
- 78
- 65
-
6"Remember to save this Gist as secret if you do not want others to see it." Be careful - Other people can see your secret gist if they happen to have its URL. See https://help.github.com/articles/about-gists/#secret-gists – Gan Feb 03 '17 at 09:40
-
How does this answer the difference between Gists and Github? (or Github repos - the question OP probably really meant to ask) This does not address the original question at all – JoelAZ Sep 06 '18 at 05:37
-
This answer does a good job in defining both terms. Then the difference between them is clear. – Haniver Oct 07 '21 at 19:09
GitHub Gists
To gist or not to gist. That is the $64 question ...
GitHub Gists are Single (or, multiple) Simple Markdown Files
with repo-like qualities that can be forked or cloned (if public).
Otherwise, not if private.
Kinda like a fancy scratch pad that can be shared.
Similar to this comment scratch pad that I am typing on now, but a bit more elaborate.
Whereas, an official, full GitHub repo is a full blown repository of source code src
, supporting documents (markdown, html, or both) docs
or root
, images png
, ico
, svg
, and a config.sys
file for running Yaml variables hosted on a Jekyll server.
Does a simple Gist file support Yaml front matter?
Me thinks not.
From the official GitHub Gist documentation ...
The gist editor is powered by CodeMirror.
However, you can copy a public Gist (or, a private Gist if the owner has granted you access via a link to the private Gist) ...
And, you can then embed that public Gist into an "official" repo page.md
using Visual Studio Code, as follows:
"You can embed a gist in any text field that supports Javascript, such as a blog post."
"To get the embed
code, click the clipboard icon next to the Embed URL
button of a gist."
Now, that's a cool feature.
Makes me want to search (discover) other peoples' gists, or OPG and incorporate their "public" work into my full-blown working repos.
"You can discover the PUBLIC gists others have created by going to the gist home page and clicking on the link ...
All Gists{:title='Click to Review the Discover Feature at GitHub Gists'}{:target='_blank'}."
Caveat. No support for Liquid tags at GitHub Gist.
I suppose if I do find something beneficial, I can always ping-back, or cite that source if I do use the work in my full-blown working repos.
Where is the implicit license posted for all gists made public by their authors?
Robert
P.S. This is a good comment. I think I will turn this into a gist
and make it publically searchable over at GitHub Gists.
Note. When embedding the <script></script>
html tag within the body of a Markdown (.md) file, you may get a warning "MD033" from your linter.
This should not, however, affect the rendering of the data (src) called from within the script
tag.
To change the default warning flag to accommodate the called contents of a script
tag from within Visual Studio Code, add an entry to the Markdownlint Configuration Object within the User Settings
Json file, as follows:
// Begin Markdownlint Configuration Object
"markdownlint.config": {
"MD013": false,
"MD033": {"allowed_elements": ["script"]}
}// End Markdownlint Configuration Object
Note. Solution derived from GitHub Commit by David Anson

- 332
- 3
- 5

- 99
- 1
- 5
-
1Take a moment to read through the [editing help](//stackoverflow.com/editing-help) in the help center. Formatting on Stack Overflow is different than other sites. – Claudia Feb 07 '18 at 22:32
-
Also, GitHub Gist allows you post a *lot* more than just code. [Here's a concrete example of this](https://gist.github.com/isiahmeadows/ff0791a7dac10f06751006c6be4d6755), and yes, I've actually used Git with it. (You can actually treat them as full-blown repos from a Git client, including extra branches; you just don't have all the issue management, web interfaces for basic Git stuff, and other niceties that go with it being in a proper GH repo.) – Claudia Feb 07 '18 at 22:38
“Gists are actually Git repositories, which means that you can fork or clone any gist, even if you aren't the original author. You can also view a gist's full commit history, including diffs.”
→ check out the official github documentation
So the key difference is, that they are single files.
Oh, and: gists can be “secret” (as in: private url) also without being a paying github customer, if I understand correctly...
-
6
-
Cool, [didn't know that](https://github.com/blog/550-multiple-file-gist-improvements)! – Frank N Nov 14 '17 at 08:58
-
wow, so I can clone my gist, eg `git clone https://gist.github.com/jxramos/b227766a5f593b1154449217a656158d` which creates a directory on my filesystem named `b227766a5f593b1154449217a656158d` and which contains a single file `semantic_notes.md` in this case. I'll experiment developing on my gist just like a repo. Good to know. This must be how comments get added to gist revisions too. Never seen how to do that from the UI editor. – jxramos Feb 23 '20 at 07:00
In simple words:
GitHub is the entire site.
Gists are some special services.
Usage Of Both:
Gist is a simple way to share snippets and pastes with others.
GitHub is a code hosting platform for version control and collaboration of projects.
Advantages Of Github:
Documentation, Discussions, Security Alerts of known Vulnerabilities and Exposures.
Advantages Of Gists:
Because each "gist" has its own Git repository, multiple code snippets can be contained in a single paste and they can be pushed and pulled using Git.

- 956
- 3
- 15
- 20
GISTS The Gist is an outstanding service provided by GitHub. Using this service, you can share your work publically or privately. You can share a single file, articles, full applications or source code etc.
The GitHub is much more than just Gists. It provides immense services to group together a project or programs digital resources in a centralized location called repository and share among stakeholder. The GitHub repository will hold or maintain the multiple version of the files or history of changes and you can retrieve a specific version of a file when you want. Whereas gist will create each post as a new repository and will maintain the history of the file.

- 138
- 1
- 2
github allows user to version control a bunch of files under one directory (called as repository). And user can create any number of repository. So all modification (creation/deletion/modification) on the complete directory (repository) is listed to user as one revision history.
where as gist allows user to version control a single file in markdown format. And user can create any number of files. Here the modications of each files are listed separtely to user as revision history.
Generally github
is for maintaining a large number of files & directories related to one task. For example software code of a project, website files, documentation files of a particular topic etc. Where as gist
is for maintaining a personal notes of a task in markdown format.
At a high level, creating a file in gist
is equivalent to creating a single file repository in github
.

- 12,790
- 16
- 88
- 100