GitHub 和 gist 有什么区别?

发布于 2024-11-25 08:07:08 字数 177 浏览 1 评论 0 原文

gist 的目的是什么?它与使用 GitHub 进行常规代码共享/维护有何不同?

输入图像描述这里

What is the purpose of gist and how is it different from regular code sharing/maintaining using GitHub?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

思慕 2024-12-02 08:07:08

GitHub 是整个网站。 Gists 是该网站提供的一项特殊服务,即类似于 Pastebin 的代码片段。然而,一切都是由 git 修订控制驱动的,因此 gists 也有完整的修订历史。

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.

捂风挽笑 2024-12-02 08:07:08

我个人对 Gist 和 GitHub 的看法:

Gist: Gist 是一种与他人共享代码片段和粘贴的简单方法。当您需要与同事或朋友分享一段示例代码或技术时,可以使用它。

GitHub 另一方面,GitHub 提供了一个平台,可以将整个项目作为存储库在团队之间(私有存储库)或全世界(公共存储库)共享。

两者都会记录版本详细信息。

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.

萌吟 2024-12-02 08:07:08

GitHub 和 gists 之间的主要区别在于功能数量和用户界面:

GitHub 的设计考虑了大量功能和灵活性,非常适合小型和大型项目,而 gists 仅是非常适合非常小的项目。

例如,gists确实支持多文件,但界面非常简单,而且功能有限,所以他们甚至没有文件浏览器,也没有问题、拉取请求或wiki。如果你不需要这个,要点就非常好而且更离散。就像SO中的评论,而不是答案。

注意:感谢@Qwerty 的建议,使我的评论成为真正的答案。

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.

Oo萌小芽oO 2024-12-02 08:07:08

我个人的理解或者说我个人对Gist和GitHub的用法是:

  • GitHub 是

一个大项目工作。如果您想构建网站、开发移动或 Web 应用程序,或者与队友一起完成作业,当然可以使用 GitHub。

  • 要点

更像是一份备忘录。例如,您可以编写一个小功能的实现并将其分享到您的博客,或者写下您对该项目的想法并与您的队友分享。
就像上面的答案所说的那样,Gist 用于更像代码片段的东西。所以通常如果你从事一个项目,你会使用 GitHub。

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.

睡美人的小仙女 2024-12-02 08:07:08

您可以通过访问以下网址 gist.github.com 来访问 Gist。
或者,您可以从您的 Github 帐户(登录后)访问它,如下图所示:

如何从 github 控制台访问 gist

 

Github:一种托管服务,包含基于 Web 的 git 存储库。它包括 git 的所有功能以及附加功能
已添加。

 

要点:是添加到 github 的附加功能,允许共享代码片段、注释、待办事项列表等。您可以保存
您的要点是秘密的还是公开的。秘密要点在搜索中被隐藏
引擎,但您与之共享网址的任何人都可以看到。

例如。如果您想写一份私人待办事项清单。您可以使用 Github Markdown 编写一个,如下所示:

如何编写私人待办事项列表

注意: 保留短划线和括号之间的空白非常重要,如上所示。
使用扩展名 .md 保存文件也很重要,因为我们希望 Markdown 格式正确。
如果您不想让其他人看到它,请记住将此要点保存为秘密。

 

最终结果如下图所示。这些复选框是可单击的,因为我们使用扩展名 .md

如果格式正确,待办事项列表会是什么样子

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:

how to access gist from within the github console

 

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:

how to write a private to do list

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

What the to do list looks like if you have formatted it properly

狼性发作 2024-12-02 08:07:08

GitHub Gists

要点或不要点。这是 64 美元的问题...

GitHub Gists单个(或多个)简单 Markdown 文件,具有可以分叉的类似存储库的品质或克隆(如果公开)。

否则,不是私人的。

有点像可以共享的精美便笺本。

与我现在正在输入的评论草稿本类似,但更详细一些。

官方完整的 GitHub 存储库是一个完整的源代码存储库 src、支持文档(markdown、html 或两者)docsroot、图像 pngicosvgconfig.sys用于运行 Jekyll 服务器上托管的 Yaml 变量的文件。

一个简单的 Gist 文件是否支持 Yaml front Matter?

我认为不是。

来自官方 GitHub Gist 文档...

gist 编辑器由 CodeMirror 提供支持。

但是,您可以复制公共要点(或者,如果所有者已通过私有要点的链接授予您访问权限,则可以复制私有要点)...

然后,您可以将该公共要点嵌入到“官方”存储库中 page.md 使用 Visual Studio Code,如下所示:

“您可以在任何支持 Javascript 的文本字段中嵌入要点,例如博客文章。”

“要获取嵌入代码,请单击要点的嵌入URL按钮旁边的剪贴板图标。”

现在,这是一个很酷的功能。

让我想要搜索(发现)其他人的要点,或 OPG 并将他们的“公共”工作纳入我成熟的工作存储库中。

“您可以通过转到要点主页并单击链接来发现其他人创建的公共要点...

全部Gists{:title='点击查看 GitHub Gists 上的发现功能'}{:target='_blank'}。"

警告。 GitHub Gist 不支持 Liquid 标签。

我想,如果我确实发现了一些有用的东西,我总是可以回复,或者如果我确实在我成熟的工作存储库中使用了该工作,我可以引用该来源。

作者公开的所有要点的隐含许可在哪里发布?

罗伯特·

P.S.这是一个很好的评论。我想我会把它变成一个要点,并使其可以在 GitHub Gists 上公开搜索。

注意。在 Markdown (.md) 文件正文中嵌入 html 标记时,您可能会从 linter

但是,这不应影响从 script 标记内调用的数据 (src) 的呈现。

要更改默认警告标志以适应 Visual Studio Code 中 script 标记的调用内容,请向 用户设置中的 Markdownlint 配置对象 添加一个条目 Json文件,如下:

// Begin Markdownlint Configuration Object
"markdownlint.config": {
  "MD013": false,
  "MD033": {"allowed_elements": ["script"]}
}// End Markdownlint Configuration Object

注意。解决方案源自 David Anson 的 GitHub Commit

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

话少心凉 2024-12-02 08:07:08

“Gists 实际上是 Git 存储库,这意味着您可以分叉或克隆任何 Gist,即使您不是原作者。您还可以查看要点的完整提交历史记录,包括差异。”

→ 查看官方 github 文档

所以关键的区别是,它们是单个文件。

哦,还有:要点可以是“秘密”(如:私人网址)如果我理解正确的话,也不是付费的 github 客户......

“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...

羅雙樹 2024-12-02 08:07:08

简单来说:

GitHub 是整个网站。

要点是一些特殊服务。

两者的用法:

Gist 是一种与他人共享片段和粘贴的简单方法。

GitHub 是一个用于版本控制和项目协作的代码托管平台。

Github的优点:

已知漏洞和暴露的文档、讨论、安全警报。

要点的优点:

由于每个“要点”都有自己的 Git 存储库,因此单个粘贴中可以包含多个代码片段,并且可以使用 Git 推送和拉取它们。

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.

静水深流 2024-12-02 08:07:08

GISTS
The Gist 是 GitHub 提供的一项出色服务。使用此服务,您可以公开或私下分享您的作品。您可以共享单个文件、文章、完整的应用程序或源代码等。GitHub

不仅仅是 Gists。它提供了大量服务,将项目或程序数字资源组合到一个称为存储库的集中位置,并在利益相关者之间共享。 GitHub 存储库将保存或维护文件的多个版本或更改历史记录,您可以在需要时检索文件的特定版本。而 gist 会将每个帖子创建为新存储库,并维护文件的历史记录。

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.

ㄟ。诗瑗 2024-12-02 08:07:08

github 允许用户对一个目录(称为存储库)下的一堆文件进行版本控制。用户可以创建任意数量的存储库。因此,对整个目录(存储库)的所有修改(创建/删除/修改)都会作为一个修订历史记录向用户列出。

其中 gist 允许用户以 Markdown 格式对单个文件进行版本控制。用户可以创建任意数量的文件。这里每个文件的修改都单独列出给用户作为修订历史记录。

一般github是为了维护大量的文件&与一项任务相关的目录。例如项目的软件代码、网站文件、特定主题的文档文件等。其中 gist 用于以 Markdown 格式维护任务的个人笔记。

从较高层次来看,在 gist 中创建文件相当于在 github 中创建单个文件存储库。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文