LinuxCommandLibrary

gist

Create Gists from the command line

TLDR

Log in to gist on this computer

$ gist --login
copy

Create a gist from any number of text files
$ gist [file.txt] [file2.txt]
copy

Create a private gist with a description
$ gist --private --description "[A meaningful description]" [file.txt]
copy

Read contents from stdin and create a gist from it
$ [echo "hello world"] | gist
copy

List your public and private gists
$ gist --list
copy

List all public gists for any user
$ gist --list [username]
copy

Update a gist using the ID from URL
$ gist --update [GIST_ID] [file.txt]
copy

SYNOPSIS

gist [-p] [-P] [-s] [-d ] [-f ] [-o] [-c] [-n] [ ...]

PARAMETERS

-p
    Create a public gist.

-P
    Create a private gist.

-s
    Create a secret gist.

-d
    Add a description to the gist.

-f
    Use a specific filename for the gist content if reading from standard input.

-o
    Open the gist in your default web browser after creation.

-c
    Copy the gist URL to the clipboard after creation.

-n
    Do not use the filename as description

...
    Files to include in the gist. If no files are specified, reads from standard input.

DESCRIPTION

The `gist` command is a command-line tool that allows you to create, manage, and share snippets of code and text directly from your terminal using GitHub Gists. It simplifies the process of creating gists without needing to go through the GitHub website. You can pipe output from other commands directly into `gist`, or create gists from existing files. Gists can be public (visible to anyone) or private (only visible to you), enabling quick and easy sharing of code snippets for collaboration, debugging, or general note-taking. It streamlines the workflow for developers who frequently use Gists to store and share code samples. It typically requires authentication with your GitHub account to create gists.

CAVEATS

The `gist` command typically requires a Ruby environment and the `gist` gem to be installed. Authentication with GitHub is necessary for private gists. Different implementations of `gist` may have slightly different options and behaviors.

INSTALLATION

Installation is commonly done using RubyGems: `gem install gist`. Ensure you have Ruby and RubyGems installed beforehand. You also need to authenticate against Github.

AUTHENTICATION

You must be authenticated with GitHub for private and secret gists to work. Some versions store your token in `~/.gist`. Check documentation for details.

HISTORY

The `gist` command was created to simplify the process of creating and sharing code snippets on GitHub Gist from the command line. Its development aims to provide a more efficient and convenient way for developers to leverage GitHub Gists in their workflows. The initial versions probably required manual configuration and installation but, over time, it was improved to be easier to install and use. Now it is often available through package managers like gem.

SEE ALSO

curl(1), git(1)

Copied to clipboard