问题
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?
回答1:
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
- 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.
- PRO: It retains gist commits from other authors
- CON: In spite of #2, it shows only 1 contributor (which is myself).
- 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.
回答2:
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").
来源:https://stackoverflow.com/questions/21811581/fork-gist-to-repo-on-github