I have a Git repository on my computer with a single file coins.py
How can I get that as a Gist on Github, preserving history?
Go to your Gist and click the Edit button at the top right. The Gist editor will show your files in edit mode, then look at the bottom left and there you will find an 'Add file' button. Click it and the cursor will be moved to the 'File name box..', type a name and click the 'Update gist' button at the bottom right.
Gist is a simple way to share snippets and pastes with others. Whereas Repo is simply a place where the history of your work is stored.
This is actually quite simple. You can move your existing history into a Gist repo like you would move it into any other:
https://gist.github.com/<LONG-HEXNUMBER>.git
(if you prefer using SSH URLs, you can use [email protected]:<THAT-SAME-HEXNUMBER>.git
instead)git remote add origin <URL>
, where origin
is an unused local name for the remotemaster
branch, you will want to overwrite the remote one with git push -f origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With