We all know the struggle, you want to share something on GitHub but it is only a single file and a whole repository would be overkill.
Good thing there is GitHub gist. Gists are basically single-file repositories.
But how do you manage them? I haven’t found a way to do so with git itself yet, but there is a special tool for that.
They do provide excellent installation instructions so just follow them.
Login is almost the last thing they mention in the readme but if you do not login before you upload your file, it will be anonymous and not linked to your account.
Gist will store an authentication token somewhere so you only have to login once.
gist -d "My Description" file.sh
The -d options isn’t necessary but is useful to describe your gist.
When the upload is done you get the link of your gist.
gist -u GIST_ID file.sh
Simple, but where do i find my GIST_ID? Well, it is written at the end of your URL of the gist.
For example https://gist.github.com/4e05681b343c7b638a33, where 4e05681b343c7b638a33 is your GIST_ID.