Question

I have a bunch of templates I made in Gist form so people can discuss them at the bottom.

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? If not either of those two, can it be done via shell?

Was it helpful?

Solution

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.

I just put in https://gist.github.com/RichardBronosky/1aed6606b1283277e7ff9eaa18097e78 and AWS_subnets and it created https://github.com/RichardBronosky/AWS_subnets for me.

Important Feature Notes

  1. PRO: It keeps all previous commit history including commit messages
    • Many people don't realize that gist commits may have commit messages that you cannot see with the web interface. The gist above has 2 very decrsiptive commit messages that I commited on my local clone and pushed out. They are hidden from the gist web interface, but show up in clones and also new repos created using this import feature.
  2. PRO: It retains gist commits from other authors
  3. CON: In spite of #2, it shows only 1 contributor (which is myself).
  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)

Verdict

This works very well and I really appreciate the PROs. 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. 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.

OTHER TIPS

Is it possible to fork a Gist to Repo via the GitHub site or client?

Not directly.

You can try to add a bookmarklet like "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.
(As in "Transfer gist repo into a 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).

Each gist indicates which forks have activity, making it easy to find interesting changes from coworkers or complete strangers.

Gist forks -- 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).

Again, there is no direct pull request supported (still valid in 2020).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top