简体   繁体   English

Fork Gist 到 GitHub 上的回购

[英]Fork Gist to Repo on GitHub

I have a bunch of templates I made in Gist form so people can discuss them at the bottom.我有一堆以 Gist 形式制作的模板,以便人们可以在底部讨论它们。

We like to copy these files and paste them into a repo and make an addon there.我们喜欢复制这些文件并将它们粘贴到存储库中并在那里制作插件。 Is it possible to fork a Gist to Repo via the GitHub site or client?是否可以通过 GitHub 站点或客户端将 Gist 分叉到 Repo? If not either of those two, can it be done via shell?如果不是这两者中的任何一个,可以通过shell完成吗?

New Correct Answer新的正确答案

Yes, directly!对,直接!

Go to https://github.com/new/import and put in the URL of your gist and a name for your new repo.转到https://github.com/new/import并输入您的要点的 URL 和新存储库的名称。

I just put in https://gist.github.com/RichardBronosky/1aed6606b1283277e7ff9eaa18097e78 and AWS_subnets and it created https://github.com/RichardBronosky/AWS_subnets for me.我刚刚输入了https://gist.github.com/RichardBronosky/1aed6606b1283277e7ff9eaa18097e78和 AWS_subnets,它为我创建了https://github.com/RichardBronosky/AWS_subnets

Important Feature Notes重要功能说明

  1. PRO: It keeps all previous commit history including commit messages PRO:它保留所有以前的提交历史,包括提交消息
    • Many people don't realize that gist commits may have commit messages that you cannot see with the web interface.许多人没有意识到要点提交可能具有您在 Web 界面中看不到的提交消息。 The gist above has 2 very decrsiptive commit messages that I commited on my local clone and pushed out.上面的要点有 2 个非常具有描述性的提交消息,我在我的本地克隆上提交并推出了它们。 They are hidden from the gist web interface, but show up in clones and also new repos created using this import feature.它们在 Gist Web 界面中是隐藏的,但会显示在克隆以及使用此导入功能创建的新存储库中。
  2. PRO: It retains gist commits from other authors PRO:它保留了其他作者的要点提交
  3. CON: In spite of #2, it shows only 1 contributor (which is myself). CON:尽管是#2,但它只显示了 1 个贡献者(也就是我自己)。
  4. CON: Even though my gist shows " forked from nboubakr/subnet.py ", this new/imported github repo does not show that it is a fork of anything (not nboubakr's gist nor my gist)缺点:即使我的要点显示“从 nboubakr/subnet.py 分叉”,这个新的/导入的github 存储库没有表明它是任何东西的分叉(不是 nboubakr 的要点也不是我的要点)

Verdict判决书

This works very well and I really appreciate the PROs.这非常有效,我非常感谢 PRO。 The cons are not enough to make me think that some other method would be better.缺点不足以让我认为其他方法会更好。

I will use this extensively in the future because I often create a gist that answers some Stack Overflow question.我将在未来广泛使用它,因为我经常创建一个回答一些 Stack Overflow 问题的要点。 Then I expand upon it and realize it should be a full repo.然后我扩展它并意识到它应该是一个完整的回购。 Not that I think my work is of great significance , but because I think my commit messages are worth sharing.并不是我认为我的工作意义重大,而是因为我认为我的提交信息值得分享。 And this is because I am lazy and tend to not want to create documentation that just repeats what i have already said in commit messages.这是因为我很懒惰,并且往往不想创建只重复我在提交消息中已经说过的内容的文档。

Is it possible to fork a Gist to Repo via the GitHub site or client?是否可以通过 GitHub 站点或客户端将 Gist 分叉到 Repo?

Not directly.不直接。

You can try to add a bookmarklet like " Fork your own Gist ".您可以尝试添加像“ Fork your own Gist ”这样的书签。
But there won't be any pull request feature .但是不会有任何拉取请求功能

If that becomes an issue, it is better to create a full-fledged GitHub repo out of your Gist collection of files.如果这成为一个问题,最好从您的 Gist 文件集合中创建一个完整的 GitHub 存储库。
(As in " Transfer gist repo into a github one "). (如“将 gist repo 转移到 github one ”中那样)。


Since my original answer in 2014, the ability to fork a gist (as mentioned in Bruno-Bronosky 's answer ) was added (around 2015).自从我在 2014 年的原始答案中,添加了分叉要点的能力(如Bruno-Bronosky答案中所述)(大约在 2015 年)。

Each gist indicates which forks have activity, making it easy to find interesting changes from coworkers or complete strangers.每个要点都指示哪些分叉有活动,从而可以轻松地从同事或完全陌生的人那里找到有趣的变化。

要点叉 -- https://help.github.com/assets/images/help/gist/gist_forks.png

See for instance " A basic collaboration workflow on Gist " (Apr. 2015) from Giovanni Cappellotto ( potomak on GitHub).例如,参见Giovanni Cappellotto (GitHub 上的potomak )的“ Gist 上的基本协作工作流程”(2015 年 4 月)。

Again, there is no direct pull request supported (still valid in 2020).同样,不支持直接拉取请求(2020 年仍然有效)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM