• Stars
    star
    794
  • Rank 57,349 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Do GitHub operations from the `git` command

Name

git-hub - The Git command for GitHub

git-hub

Synopsis

Here are just a few of the things you can do on GitHub with a simple command:

git hub                             # Show the `git hub` cheat sheet
git hub help                        # Show this awesome documentation
git hub setup                       # Config dialog. Do this first!

git hub user <user>                 # Get info about a user
git hub repos <owner>               # List recent repositories
git hub repo-new <repo>             # Create a new repository
git hub fork <owner>/<repo>         # Fork a repository
git hub clone <owner>/<repo>        # Clone a GitHub repository
                                    # Set/Change your repo description
git hub repo-edit <repo> description 'Just another GitHub repo'
git hub repo-delete <owner>/<repo>  # Delete a repository
git hub followers <user>            # List a user's followers
git hub star ingydotnet/git-hub     # Star this repository
git hub watch ingydotnet/git-hub    # Watch this repository
git hub follow ingydotnet           # Follow this author
git hub trust ingydotnet            # Add collaborators to repo
                                    # Stalk all your followers
git hub followers -ra | git hub user -
git hub gists <user>                # List gists for a user

Description

The hub subcommand for git, allows you to perform many of the operations made available by GitHub's v3 REST API, from the git commandline command.

You can fork, create, delete and modify repositories. You can get information about users, repositories and issues. You can star, watch and follow things, and find out who else is doing the same. The API is quite extensive. With this command you can do many of your day to day GitHub actions without needing a web browser.

You can also chain commands together using the output of one as the input of another. For example you could use this technique to clone all the repos of a GitHub user or organization, with one command. See PIPE AND EACH below.

Installation

There are currently 3 ways to install git-hub. For all of them you need to get the source code from GitHub:

git clone https://github.com/ingydotnet/git-hub /path/to/git-hub

The first installation method is preferred: source the .rc file. Just add a line like this one to your shell startup script:

source /path/to/git-hub/.rc

That will modify your PATH and MANPATH, and also enable command completion.

The second method is to do these things by hand. This might afford you more control of your shell environment. Simply add the lib and man directories to your PATH and MANPATH:

export PATH="/path/to/git-hub/lib:$PATH"
export MANPATH="/path/to/git-hub/man:$MANPATH"

See below for info on how to turn on Command Completion.

The third method is a standard system install, which puts git-hub next to your other git commands, do this instead:

make install        # Possibly with 'sudo'

To install to a place of your choice:

DESTDIR=/place/of/your/choice make install

The make install method does not account for upgrading and command completion yet.

See "Upgrading" and "Command Completion" below.

Command Options

Commandline options start with a dash and can appear in any order in the command. Long form commands that require an argument can use '=' or not:

--count=5
--count 5
-c <number>, count=<number>

This option is for commands that return a list of things. Specify the number of items you want the command to return. Each list command has a reasonable default value.

-a, --all

Show all elements for list commands. Also applies to a few other commands as documented.

-r, --raw

For commands that produce lists, just list the raw data. For commands that produce reports, show the raw storage keys, rather than the human friendly ones. You will need the raw keys to edit/change values.

-j, --json

For some commands, you can get the raw data in JSON.

-

This option, just a single '-', is small but very powerful. It means to read the next line from stdin, and put the content into the command at that point. See PIPE and EACH below.

=

Like the '-' command above, but reads each word from stdin.

-h

Show the brief command usage.

--help

Show the full documentation.

-q, --quiet

Show minimal output.

-v, --verbose

Show detailed output. Notably, show the raw command that is used for the GitHub API calls.

--token=<api-token>

Set or override the api-token required by the command. This value can also come from the GIT_HUB_API_TOKEN environment variable. Usually this value comes from your ~/.git-hub/config file.

-d --dryrun

Don't actually make the API call. This option turns on verbose mode.

-T

Show the API token in the verbose output. Hidden by default. This option turns on verbose mode.

-A, --use-auth

Use authentication whether or not it is needed for a certain command. This is useful if you have exceeded your hourly GitHub API rate limit, which is 60 calls unauthenticated, and 5000 calls authenticated.

-C --no-cache

There are currently known bugs in GitHub's cache headers. If the content seems stale, use this option.

Debug Options

There are a number of debug options that will give you lots of extra information (albeit in a less pretty format).

-O

Show the API reponse output. Always in JSON format. JSON is pretty-printed.

-H

Show the API response headers.

-J

Show the API response JSON, in decoded form.

-R

Repeat the last command, using the previous API server response. Useful for development and debugging. (Beware, only caches the most recent API call, so not really good for commands that make multiple calls).

-x

Turn on Bash -x debugging. This will show every bash command executed in the program. This is extremely useful to track down nasty bugs.

Arguments

The git hub command gets its input values from these sources (in this order):

  • Commandline arguments (see specific command, below).

  • Environment variables of the form GIT_HUB_VARIABLE_NAME.

  • The ./.git/config file. (The repo you are issuing commands from)

  • The ~/.git-hub/config file.

Most of the commands described below have arguments. This section defines each of the argument types. Note that argument values that are strings containing whitespace need to be quoted.

Argument variable names are always indicated by angle brackets, like: <<variable >>. Arguments listed in square brackets are optional and arguments followed by ... indicate that more than one is allowed.

<user>

A GitHub user name. Sometimes an organization name can be used instead. If this argument is optional, it defaults to the GitHub owner of the repo you are currently in. If you are not in a GitHub repo, it defaults to your login. Override: GIT_HUB_USER_NAME environment variable.

<owner>

A GitHub user or organization that owns the repository being specified. This value defaults much like the <user> argument (above). Override: GIT_HUB_OWNER_NAME environment variable.

<org>

A GitHub organization name. Override: GIT_HUB_ORG_NAME environment variable.

<repo>

A GitHub repository name. If this argument is optional, it defaults to the GitHub repo name of the repo you are currently in. Override: GIT_HUB_REPO_NAME environment variable.

<owner>/<repo>

Many commands need both an owner and repo separated by a slash. If the owner is you (your GitHub login) you can omit it (but you still need the leading slash). Like /myrepo, instead of me/myrepo. If this argument is optional, it defaults the the owner and repo of the GitHub repo you are in.

<key-value-pair>

Two strings separated by whitespace. Values with embedded whitespace should be quoted. The documentation of each command that needs these pairs, will list the valid keys.

<api-token-id>

The integer number id of a token (not the 40 hex-character value).

<scope-name>

One of the GitHub scopes that you can apply to a token. The git hub scopes command will tell you all of these, and what they mean.

Commands

These are the commands you can use to perform most of your daily GitHub interactions from the command line. They are installed by default.

help

Show this manpage.

version

Print version info for git-hub.

info

Show detailed version and environment info about your git-hub installation. This can be useful for figuring out things about how git-hub is operating in a given situation. Also good for reporting bugs / issues in git-hub.

setup

Before you can use the commands described below, you need to perform some setup/configuration steps.

This "wizard" style dialog, will walk you through the configuration process quickly and painlessly, with lots of explanation. You should run this command right away. You can also re-run it, and it will allow you to change your config, while defaulting to your existing settings.

If you would rather do the steps by hand, see #Configuration-Commands below.

upgrade

Upgrade the git-hub installation to the latest version. Note: you need to be running 'git-hub' from the source repo, and be on the main branch for this to work.

user [<user>]

Show basic information about a specific user. User defaults to the owner of the current repo, or your login if you are not inside a repo directory. The --raw and --json options show the data in different formats than normal output.

user-get <user> <data-key>

Get a specific data value for a particular user.

user-edit <key-value-pair>...

Set specific fields of your user info to new values. You list the parameters as key/value pairs.

You can edit the following user keys: name, email, blog, location, company, bio.

orgs [<user>]

List the organizations that a user is a member of.

org <org>

Show basic information about a GitHub organization. The --raw and --json options show the data in different formats than normal output.

org-repos <org>

Show all the repos for an organization, both public and private.

org-members <org>

List members of an organization.

org-get <org> <data-key>

Get a specific data value for a particular organization.

org-edit <org> <key-value-pairs>...

Set specific meta-data fields of an organization to new values. You list the parameters as key/value pairs.

You can edit the following organization keys: name, email, billing_email, blog, location, company.

teams <org>

List the teams in an organization.

team <team_id>

Get information about a team.

team-members <team_id>

List members of a team.

team-repos <team_id>

List repos of a team.

team-repo-add <team_id> <repo>

Add repo to a team. Repo name must not include org name.

team-new <org> <name> <perm>

Add a new team (name) to an organization. The 'perm' arg must be pull, push or admin.

team-delete <team_id>

Delete a team.

members <org>|<team_id>

List the members of an organization or team. If numeric argument, show team members, else organization members.

member-get <team_id> <user>

Show whether a user is a member of a specified team.

member-add <team_id> <user>

Add a user to a team.

member-remove <team_id> <user>

Remove a user from a team.

followers [<user>]

List the people who are followers of a user.

follows <user> [<target-user>]

Check if <user> follows <target-user>. The default target user is you.

following [<user>]

List the people that a user is following.

follow <user>...

Follow one or more users.

unfollow <user>...

Stop following one or more users.

clone ([<owner>/]<repo> [<directory>])...

Clone a GitHub repo. Always uses --recursive so you get submodules too. You can specifiy a list of repos. If you specify a directory for a repo, it should be an absolute path name or else begin with '.' or '..' so that it can be distinguished from another repo name.

repos [<user>]

List the repos for a user or organization. List is returned in order of recent activity.

repo [<repo>]

Show basic information about a specific repository. The --raw and --json options show the data in different formats than normal output.

repo-get <owner>/<repo> <data-key>

Get a specific data value for a particular repository.

repo-edit [<owner>/]<repo> <key-value-pair>...

Set specific meta-data fields of a repository to new values. You list the parameters as key/value pairs.

You can edit the following repo keys: description, homepage.

repo-new [<org>/]<repo>

Create a new GitHub repository.

repo-init [<directory>]

This command is useful for setting up new repos. Just mkdir a new dir, cd into it and issue the command. It will 'git init', make the GitHub repo and add it as the origin remote. It will only do the things that have not yet been done.

repo-delete <owner>/<repo>

Delete a GitHub repository.

forks [<owner>/<repo>]

List the forks of a repository.

fork <owner>/<repo> [--org=<org>] [--remote=<name>]

Fork a repository to your account or to an organization. Optionally, you can specify the name of a remote to add, pointing to your fork.

stars [<owner>/<repo>]

Show what users have starred a repository.

star [<owner>/<repo>]

Add your star to a repository.

unstar [<owner>/<repo>]

Remove your star from a repository.

starred [<user>]

List repositories that a user has starred.

watch [<owner>/<repo>]

Start watching a repo.

unwatch [<owner>/<repo>]

Stop watching a repo.

watching [<user>]

Show which repos a user is watching.

watchers [<owner>/<repo>]

Show the users who are watching a repo.

collabs [<owner>/<repo>]

List current collaborators for a repository.

trust [<owner>/<repo>] <user>...

Add one or more collaborators to a repository.

untrust [<owner>/<repo>] <user>...

Remove one or more collaborators from a repository.

issues [<owner>/<repo>] [--all]

List the open issues for a repo. Use the --all flag to see both open and closed issues.

issue [<owner>/<repo>] <issue-id-number>

Show info (including any comments) for a specific issue. If no issue number is given, this command will call issue-new instead.

issue-new [<owner>/<repo>]

Create a new issue for a repository.

issue-edit [<owner>/<repo>] <issue-id-number>

Add a comment. Change values of 'title', 'state', 'assignee' and 'milestone'. Changing state to 'closed' will close the issue.

comment [<owner>/<repo>] <issue-id-number>

Add a comment to an issue. You can also use issue-edit to just add a comment.

issue-close [<owner>/<repo>] <issue-id-number>

Close an issue. You can also use issue-edit to close an issue.

issue-resolve [<owner>/<repo>] <issue-id-number>

Add a comment to an issue and then close it.

pr-list [<owner>/<repo>]

List the pull requests for a repo.

pr-new [<issue-id-number>] [<options>]

Create a new pull request for a repository based on the current branch. If an issue ID number is given, this command will attach the pull request to the issue instead of creating a new one.

If the default remote is a fork, the pull request will target the default branch of the parent repository. Otherwise the pull request will target the default branch of the default remote itself. Use --remote, --branch, --parent, and --base options to change the default source remote, source branch, target remote and target branch (respectively).

This command will open an editor like git commit does. To avoid that you can pipe text into the command.

pr-diff [<owner>/<repo>] <issue-id-number>

Show the diff for a pull request.

pr-fetch [<owner>/<repo>] <issue-id-number>

Fetches a pull request to a local review/$number branch

pr-merge [<owner>/<repo>] <issue-id-number>

Merge and close a pull request.

It supports the following options:

  • --sha

  • --merge-method

  • --commit-title

  • --commit-message

pr-queue [<user>] [--all]

Show a user's Pull Request queue, for all repos. Shows the open PRs for any repo that has them. The --all option says to show closed as well as open PRs. Results are sorted by date of creation.

pr-created [<user>] [--all]

Show a list of Pull Requests the user created, for all repos. Shows the open PRs for any repo that has them. The --all option says to show closed as well as open PRs. Results are sorted by date of creation.

pr-involves [<user>] [--all]

Show a list of Pull Requests the user is involved in. ie Pull Requests that were created by, assigned to, mention, or were commented on by that user. Shows the open PRs for any repo that has them. The --all option says to show closed as well as open PRs. Results are sorted by date of creation.

notify-list [--all]

List your recent unread user notifications. To list your read notifications as well, use the --all option.

keys [<user>]

List public SSH keys for a user.

keys-add <title> <key>

Add a public ssh key for your user.

cache-clear

Clear your API response cache.

open [<owner>/<repo>] [<file-path>]

Open a browser window to a repo or a file in a repo.

url [<owner>/<repo>] [<file-path> [<line-number>]]

Print the URL of a repo or a file in a repo.

git-hub-travis

Enable and/or disable travis-ci testing from the command line.

gists [<user>]

List gists for a user.

gist <gist-id>

Show info about gist.

gist-get <gist-id> <data-key>

Get a specific data value for a particular gist.

gist-edit <gist-id> <key-value-pair...>

Set specific meta-data fields of a gist to new values. You list the parameters as key/value pairs.

gist-star <gist-id>

Add your star to a gist.

gist-unstar <gist-id>

Remove your star from a gist.

gist-delete <gist-id>

Delete a gist.

gist-clone <gist-id> [<directory>]

Clone a gist.

gist-fork <gist-id>

Fork a gist.

gist-new (public|secret) <description> <files...>

Create a gist from existing files

gist-init (public|secret) <description>

Create an (almost) empty gist and clone it

This will create a gist with a file '.gitignore'

search-repo <query>

Search for repositories.

By default it searches in the repository name, but you can change that: search-repo "libyaml in:description". For more information, see the search documentation at https://developer.github.com/v3/search/#search-repositories

search-user <query>

Search for users.

By default it searches in the login field, but you can change that: search-user "wall in:fullname". For more information, see the search documentation at https://developer.github.com/v3/search/#search-users

search-issues <query>

Search for issues and pull requests. For more information, see the search documentation at https://developer.github.com/v3/search/#search-users

Plugin Commands

You get tons of useful commands by default, and they are all listed and documented in the next section below. But git-hub also supports third party plugin commands.

This section is about the "plugin" commands that currently come with git-hub.

irc-enable <room> [<server>]

This command must be run inside a cloned repo. It enables GitHub activities for a repo to be reported to an IRC channel.

irc-enable

This command must be run inside a cloned repo. It disables the GitHub IRC webhook for a repo.

irc-url

Show the GitHub URL for setting webhooks on the current repo.

Configuration Commands

These commands are for editing your git-hub config file and managing your GitHub authentication tokens.

config [<config-key> [<config-value>]]

With no args, this command will print the contents of ~/.git-hub/config. With With one argument (a key), print the current value of the config key. With two arguments (key value), set the value of the config key. 4 keys are currently supported: login, api-token, use-auth, and json-lib.

config-unset <config-key>

Unset a config key. Removes the key from the ~/.git-hub/config file.

config-list

Will list your current configuration like git config --list

config-keys

Output all possible configuration keys

tokens

List all the API tokens for your GitHub account. Use the --raw option to print the token IDs and descriptions, but not the actual token values.

token-new [<description-string>]

Create a new API token for your GitHub login id. Note: Creating a new token will not automatically add it to your ~/.git-hub/config file; you need to do that yourself with the git hub config api-token <token-value> command. Use the --raw option to just print the new token id.

token-get <api-token-id> <data-key>

Get a specific data value for a particular token.

token-delete <api-token-id>

Delete one of your API tokens for your GitHub login id. Note: You need to delete tokens by id (listed by the tokens command), not by token value.

scopes <api-token-id>

List the scopes assigned to your API token, and also list all the possible scope values that you can assign. Use the --raw option to just list the scopes.

scope-add <api-token-id> <scope-name>...

Add one or more scopes to your API token. You can use the --all option to add all possible scopes at once.

scope-remove <api-token-id> <scope-name>...

Remove one or more scopes from your API token. You can use the --all option to remove all possible scopes at once.

Upgrading git-hub

If you used the PATH method of installation, just run this to upgrade git-hub:

git hub upgrade

Or (same thing):

cd /path/to/git-hub
git pull

If you used make install method, then run this again (after git pull):

make install        # Possibly with 'sudo'

Command Completion

The git hub command supports <TAB>-based command completion. If you don't use the .rc script (see Installation, above), you'll need to enable this manually to use it.

Completion is supported for subcommands, options and config keys.

git hub <TAB>
git hub pr-list --<TAB>
git hub config <TAB>
git hub help <TAB>

Additionally, user/repo names can be completed, but note that there might be some cases where this will not offer all possible names.

The reason is the search is restricted to 100 items, and a search cannot be anchored to the start of a string, so an API call might return 100 results, but you will only see those starting with the prefix you typed.

Completing repository names

git hub repo <TAB>          shortcut for your-login/<TAB>
git hub repo @<TAB>         shortcut for your-login/<TAB>
git hub repo foo<TAB>       shortcut for your-login/foo<TAB>
git hub repo user/<TAB>     complete repos of 'user'
git hub repo user/foo<TAB>  complete repos of 'user' starting with foo

Completing user names as part of the full repository name

For completing usernames, you have to type a @ and at least two characters.

git hub repo @in<TAB>

The @ will automatically go away if there is only one matching user, or if you add a / after it.

git hub repo @ingyd<TAB>         -> git hub repo ingydotnet/
git hub repo @ingydotnet/<TAB>   -> git hub repo ingydotnet/

Completing user names for commands like follow, user, trust

This is not supported yet.

Enabling completion

In Bash

If your Bash setup does not already provide command completion for Git, you'll need to enable that first:

source <Git completion script>

On your system, the Git completion script might be found at any of the following locations (or somewhere else that we don't know about):

  • /etc/bash_completion.d/git

  • /usr/share/bash-completion/git

  • /usr/share/bash-completion/completions/git

  • /opt/local/share/bash-completion/completions/git

  • /usr/local/etc/bash_completion.d/git

  • /usr/local/opt/git/share/git-core/contrib/completion

  • ~/.homebrew/etc/bash_completion.d/git

In case you can't find any of these, this repository contains a copy of the Git completion script:

source /path/to/git-hub/share/git-completion.bash

Once Git completion is enabled (whether you needed to do that manually or not), you can turn on git-hub completion with a command like this:

source /path/to/git-hub/share/completion.bash

In zsh

In the Z shell (zsh), you can manually enable git-hub completion by adding the following line to your ~/.zshrc, before the compinit function is called:

fpath=('/path/to/git-hub/share/zsh-completion' $fpath)

You might want to enable caching (the cache is invalidated after 20 minutes):

zstyle ':completion:*' use-cache on

Plugins

The git-hub command supports plugins. All you need to do to install a plugin, is to clone the plugin repo into the plugin/ subdirectory of the git-hub repository. There are example plugins already installed. If you do a system-style install, then just make install the plugins too.

Faster

The git-hub command is written in pure Bash, including a complete JSON parser written in Bash. Unfortunately, this parser is a bit slow. It is really slow for large API payloads.

To make the git-hub command perform much faster, just run this command:

git hub config json-lib json-perl.bash

That will enable a Perl replacement, which requires Perl (of course) and the JSON.pm Perl module. If the JSON::XS Perl module is also installed, it will be even faster.

Pipe and Each

You can pipe the output of one git hub into another and multiply your power. The command being piped into should use the EACH option which is a single dash ('-'). It will cause the command to be run once for each line of input, inserting the line into the command, in place of the '-'. If you use a '=' it will do the same thing except for each "word" of input.

This command:

git hub followers --raw

will list lines containing only user ids. You can pipe it into commands needing a user id, like:

git hub followers --raw | git hub user - --json

Thus printing the JSON user info for each follower. Same as:

for _ in `git hub followers --raw`; do
  git hub user $_ --json
done

For '=' you can do things like:

echo alice bob chelsea | git hub trust =

to trust a list of users in one go.

Token Authentication and Scopes

Many endpoints of the GitHub v3 API require a Personal API Access Token. You can list your current tokens with this command:

git hub tokens

If you don't have any tokens or want a new one for the git-hub command, run these commands (the git hub setup command automates this):

git hub token-new "my git-hub command token"
git hub scope-add <token-id> user repo
git hub scopes <token-id>
git hub config api-token <token-value>

You can also see all your tokens on the web at thispage.

You can specify your API token to git hub on the commandline with --token=... or in the GIT_HUB_API_TOKEN environment variable, but the easiest thing to do is just set it in the git-hub config.

Certain token scopes are required for various GitHub API operations. Make sure your token has the scopes turned on for the things you want to do. See the scopes, scope-add and scope-remove git hub subcommands.

NOTE: All the git hub commands dealing with tokens and scopes require you to enter your GitHub password. If you need to issue a bunch of these commands and you don't want to retype your password each time, you can put your password in the GIT_HUB_PASSWORD environment variable.

Rate Limits

GitHub limits unauthenticated API calls to 60 per hour, and authenticated API calls to 5000 per hour. For this reason you may wish to use authentication even for calls that don't need it. You can use the -A/--use-auth option to make sure a command uses authentication. You can also set the config file to always use authentication, with this command:

git hub config use-auth true

Another option is to set the GIT_HUB_USE_AUTH environment variable:

export GIT_HUB_USE_AUTH=true

ETAG Caching

GitHub provides ETag headers in the API responses, and git-hub uses them to cache responses, by default. When you use this feature, your rate-limit usage is not affected for cached responses.

GitHub has had caching bugs in their API in the past. If you suspect the cache is stale, you may want to try these options:

  • Use the -C (--no-cache) flag on a request to bypass the cache.

  • Set GIT_HUB_NO_CACHE=true to bypass the cache.

  • Run git hub config no-cache true to never use the cache.

  • Run git hub cache-clear to erase all the cached values.

Colors

You can have colored output. You can activate that by setting git hub configcolor auto. It accepts the same values as git config color.ui itself.

Examples

The following sections show lots of interesting ways to use git hub. Let your imagination be your guide.

Example 1. Create a new repo and GitHub origin

Do everything from the command line:

$ mkdir foo
$ cd foo
$ git hub repo-init
$ echo 'The new foo' > README
$ git add README
$ git commit -m 'First commit'
$ git push origin main
$ git hub repo-edit \
    description  'The new foo' \
    homepage     http://example.com
$ git hub repo

The repo-init command will create a new GitHub repository using the directory name as the repo name. Note that on the last two commands you don't need to set the <repo> because it can be gleaned from the remote. Also on the edit command notice how you can specify multiple key/value pairs.

To just create a new github repo without cloning it, use git hub repo-new.

Example 2. Commands from within a repo

Assume your current working directory is not a GitHub repo:

$ # List *your* repos:
$ git hub repos
$ # Clone someone else's repo:
$ git hub clone ingydotnet/git-hub
$ # cd into it:
$ cd git-hub
$ # Get info about ingydotnet:
$ git hub user
$ # Show ingydotnet's recent repos:
$ git hub repos
$ # Show info about ingydotnet/git-hub:
$ git hub repo
$ # Fork the git-hub repo:
$ git hub fork
$ # Follow ingydotnet:
$ git hub follow
$ # See who ingydotnet is following:
$ git hub following
$ # Star the ingydotnet/git-hub repo:
$ git hub star
$ # etc...

The git hub command tries to be environmentally aware. If you are in a GitHub cloned repo directory, and you don't specify <user> or <<owner >> or <repo> for a command that needs them, then they will be pulled from the remote url. Otherwise, if you don't specify a <user> it will use the one (presumably yours) that you set with the git hub configlogin ... command.

Example 3. Building Complex Commands

The git hub command can be used to output raw data, which can be fed into other commands; even other git hub commands. This lets you do some powerful automation with very little code. The --raw (-r) flag will make the output of many commands be usable as data, and the - (EACH) option makes commands read data from stdin.

Get information about all your followers:

for user in $(git hub followers <your-login> -r); do
  git hub user $user
done

Or more simply by using PIPE and EACH:

git hub followers -r | git hub user -

Follow all your followers:

git hub followers -r | git hub follow -

Find out if the people you are following, are following you!

git hub following -r | git hub follows -

View all the open issues on a repository at once:

git hub issues -r | git hub issue -

Clone all the repos in an organization:

git hub repos <org> -r | git hub clone -

Star the latest 5 repos from all the people you are following that have more than 50 repos:

git hub following <your-login> -r |
  git hub user-get - public_repos |
  perl -nle 'print if $_ > 50' |
  git hub repos - -rc5 |
  git hub star -

Author

Written by Ingy dรถt Net <[email protected]>

Status

This command is over a year old. It does a ton of stuff well, but still has a lot to do to be complete.

The plan is to support as much of the API as possible. Patches / Pull Requests welcome. See the file notes/todo in the git-hub repo for upcoming changes.

Try make test. There are tests in place but testing is not yet extensive. Expect more testing soon. Also please include tests-in-kind for any patches you submit.

Find 'ingy' on #gitcommands in irc.freenode.net if you have questions or ideas.

Copyright & License

Copyright 2013-2016. Ingy dรถt Net.

The MIT License (MIT)

More Repositories

1

git-subrepo

Shell
3,199
star
2

vroom-pm

Vim Based Slideshow Presentations
Perl
110
star
3

...

Dot Dot Dot
Perl
109
star
4

json-bash

Load, Dump and Manipulate JSON in Bash
Shell
107
star
5

jemplate

Industrial strength JavaScript template framework
Perl
64
star
6

yaml-vim

YAML Highlight script for VIM editor
Vim Script
50
star
7

mo-pm

Perl Micro Objects
Perl
41
star
8

io-all-pm

All in One Perl IO
Perl
38
star
9

bashplus

Modern Bash Programming Framework
Shell
36
star
10

yaml-libyaml-pm

Perl Binding to libyaml
C
33
star
11

pairup

Shell
29
star
12

yaml-pm

YAML Perl Module
Perl
20
star
13

dotdotdot

Organize and share your *nix dot files
Vim Script
19
star
14

pquery-pm

Perl Port of jQuery
Perl
19
star
15

cdent-py

C'Dent - Portable Module Programming Language
Python
19
star
16

inline-pm

Write Perl subroutines in other programming languages
Perl
19
star
17

xxx-pm

See Your Data in the Nude
Makefile
16
star
18

swim-pm

Perl
15
star
19

test-more-bash

Shell
15
star
20

test-base-pm

Extendable Perl Testing
Perl
13
star
21

rosettacode-pm

RosettaCode Data Extractor
Perl
12
star
22

lola

Shell
12
star
23

yaml-perl-pm

Pure Perl Port of PyYAML
Python
11
star
24

ajaxterm

Fork of antony.lesuisse.org/ajaxterm
Python
10
star
25

inline-c-pm

Perl
10
star
26

mousse-pm

A Light and Tasty Moose for CPAN Authors
Perl
10
star
27

testml-pm6

TestML for Perl 6
Perl 6
10
star
28

testml-pm

TestML for Perl
Perl
9
star
29

testml

TestML Specification and Documentation
9
star
30

git-xs-pm

Perl XS Wrapper of libgit2
C
8
star
31

package-py

Common parts for Python packages
Python
8
star
32

scim-query-filter-parser-rb

Ruby
8
star
33

stump-pm

Larry Wall's Stump Speech Slideshow Software
Perl
7
star
34

test-base-js

Test.Base module for JavaScript
7
star
35

boolean-pm

Boolean Type Support for Perl
Perl
7
star
36

live-demo

Shell
7
star
37

this-shit

Fork this-shit
7
star
38

testml-tml

TestML Tests for TestML
6
star
39

path-manip-sh

Bash PATH manipulation functions
Shell
6
star
40

yaml-book-2010

YAML - The Book
Ruby
6
star
41

pairup-stackato

PairUp! - The Pair Programming Station that runs as a Stackato App
Shell
6
star
42

only-pm

Load specific Perl module versions
Perl
6
star
43

project-site

Static Content Website Generator
Shell
6
star
44

template-toolkit-simple-pm

A Simple Interface to Template Toolkit
Perl
6
star
45

class-js

Extremely lightweight, but useful JavaScript class wrapper
Perl
6
star
46

yaml-shell-pm

A YAML/Perl Interactive Shell
Perl
6
star
47

jsony-pm

JSONY - Relaxed JSON with a little bit of YAML
Raku
6
star
48

pst

Shell
5
star
49

yaml3-pm

YAML Implementation for Perl 5 using Pegex
Perl
5
star
50

ingydotnet-resume

Ingy dot Net's resume
HTML
5
star
51

perfect-demo

Shell
5
star
52

perl5-pm

Framework module for bundling Perl5 modules
Perl
5
star
53

crockford-py

Crockford base32 encode module for Python
Python
5
star
54

app-aycabtu-pm

All Your Codez Are Belong To Us
Perl
5
star
55

zilla-dist-pm

Perl
5
star
56

ingy-dots

Personal Dot Files
Shell
5
star
57

stardoc-pm

Acmeist Documentation
Perl
5
star
58

cog-osdctw2011-talk

Cog Talk for OSDC::TW 2011
5
star
59

yaml-js

YAML for JavaScript
4
star
60

acmeism-osdctw2010-talk

Please Check Your Guns at the Door -- C'Dent, the Acmeism and Everyone
4
star
61

kwiki

Kwiki Wiki Framework
Perl
4
star
62

yamltime-pm

YAML based Time Tracker App
Perl
4
star
63

yadda

Perl
4
star
64

plack-middleware-cache-pm

Response Caching Middleware for Perl's Plack
Perl
4
star
65

file-share-pm

Improved File::ShareDir for Perl
Makefile
4
star
66

lexicals-pm

Create a hash of your 'my' variables
Perl
4
star
67

moos-pm

Moo Simple
Perl
4
star
68

wikiwyg-net-site

Wikiwyg Website - Static Content
Smalltalk
4
star
69

boot-dots

... bootstrapping dot files
Shell
4
star
70

language-snusp-pm

SNUSP Programming Language Interpreter
Makefile
4
star
71

wikitext-pm

WikiText.pm
Perl
3
star
72

testml-pgx

TestML Spec Grammar in YAML and JSON
JavaScript
3
star
73

testml-py

TestML for Python
Python
3
star
74

jsync-spec

JSYNC Specification
3
star
75

pegex-crontab-pm

Pegex Crontab Parser
Perl
3
star
76

devel-local-pm

Use development versions of other modules
Perl
3
star
77

spiffy-pm

Spiffy Perl Interface Framework For You
Perl
3
star
78

pyplay-py

Play Around in Python
Python
3
star
79

projects-ingy-net-site

Ingy's Project Site -- Static Content
Smalltalk
3
star
80

pegex-pegex-emitter-perl6regex-pm

Pegex Pegex Emitter for Perl 6 Regexes
Perl
3
star
81

yaml-pgx

Pegex Grammar for YAML
Makefile
3
star
82

yaml-to-json-docker

JavaScript
3
star
83

jsync-pm

JSYNC Module for Perl
Perl
3
star
84

module-manifest-skip-pm

MANIFEST.SKIP Management for Perl
Perl
3
star
85

alt-pm

CPAN Module Documenting the Alt Namespace
Perl
3
star
86

pegex-forth-pm

Perl
3
star
87

www.jemplate.net

JavaScript
3
star
88

xxx-pm6

See Your Perl 6 Data in the Nude
Perl
3
star
89

gloom-pm

Great Little OO Module
Perl
3
star
90

testml-code

TestML Examples
Perl
3
star
91

bpan-bash

Shell
3
star
92

yaml-dev-kit

Perl
3
star
93

test-tap-bash

Shell
3
star
94

pyyaml-mirror

A git mirror of PyYAML
Python
3
star
95

test-more-bash-pm

Shell
3
star
96

libyaml-mirror

A git mirror of libyaml
C
3
star
97

yes

CoffeeScript
2
star
98

acmeism-yapceu-2011-talk

YAPC Europe 2011 Acmeism Talk
2
star
99

pegex-ppw2010-talk

Pegex Talk at Pittsburgh Perl Workshop 2010
2
star
100

linux-setup-sh

Bash setup scripts for new Linux installs
Shell
2
star