Share your code with Github gist

Share your code with Github gist

May be most of the people aware - what is 'Github gist'.

But I was not aware and explore it recently.

So thought of sharing few details with others.


if you want to share your code or some writing - What are the options you have?

  • Either you share via email in text file.
  • or upload in Google Drive
  • or Paste the code in pastebin or other websites available.

But we can share it also using 'github gist' - it has so many advantages

Gist is an easy method to share snippets or piece of data with others.

Step 1

Open https://github.com/

On the top right hand side drop down list you will see option 'New gist'

Screenshot from 2021-01-24 21-02-34.png

Click on it

it will redirect you to https://gist.github.com/

You can directly open this URL as well

you will see below page.

Screenshot from 2021-01-24 21-07-38.png

Step 2

In gist.github.com page, you will see multiple options

  • You can view your all gist created by you by clickinig on 'View your gists' on top right corner.
  • you can create new gist. [You can create either Secret gist or Public gist]

Screenshot from 2021-01-24 21-11-32.png

Step 3

Let's write some code and create gist, give some description to your gist (example Demo gist)

Give Name of your file = demo.py (Give file extension - it Text Box will then automatically recognize language, else by default it will take as a txt file]

Screenshot from 2021-01-24 21-15-13.png

After creating, we can view our created gist

Screenshot from 2021-01-24 21-18-04.png

If we will not give file name - github gist - assign some random file itself as shown below.

Screenshot from 2021-01-24 21-19-49.png

I did not mention filename - See some random name automatically given by github gist. Also this gist i created as a public - Thus we will not able to see 'Secret' symbol in front of file name


Viewing gist commit history

To view a gist's full commit history, click the "Revisions" tab at the top of the gist.

Screenshot from 2021-01-24 21-26-48.png

Cloning gists

If you want to make local changes to a gist and push them up to the web, you can clone a gist and make commits the same as you would with any Git repository.

Screenshot from 2021-01-24 21-28-42.png