=pod
=for comment DO NOT EDIT. This Pod was generated by Swim v0.1.48. See http://github.com/ingydotnet/swim-pm#readme
=encoding utf8
=head1 Name
git-hub - The Git command for GitHub
=head1 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
=head1 Description
The B
You can fork, create, delete and modify repositories. You can get information
about users, repositories and issues. You can B
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.
=head1 Installation
There are currently 3 ways to install C
git clone https://github.com/ingydotnet/git-hub /path/to/git-hub
The first installation method is preferred: C
source /path/to/git-hub/.rc
That will modify your C
The second method is to do these things by hand. This might afford you more
control of your shell environment. Simply add the C
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 C
make install # Possibly with 'sudo'
To install to a place of your choice:
DESTDIR=/place/of/your/choice make install
The C
See "Upgrading" and "Command Completion" below.
=head1 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
=over
=item C<< -c
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.
=item C<-a>, C<--all>
Show all elements for list commands. Also applies to a few other commands as documented.
=item C<-r>, C<--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.
=item C<-j>, C<--json>
For some commands, you can get the raw data in JSON.
=item C<->
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.
=item C<=>
Like the '-' command above, but reads each B
=item C<-h>
Show the brief command usage.
=item C<--help>
Show the full documentation.
=item C<-q>, C<--quiet>
Show minimal output.
=item C<-v>, C<--verbose>
Show detailed output. Notably, show the raw command that is used for the GitHub API calls.
=item C<< --token=
Set or override the api-token required by the command. This value can also
come from the C
=item C<-d> C<--dryrun>
Don't actually make the API call. This option turns on verbose mode.
=item C<-T>
Show the API token in the verbose output. Hidden by default. This option turns on verbose mode.
=item C<-A>, C<--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.
=item C<-C> C<--no-cache>
There are currently known bugs in GitHub's cache headers. If the content seems stale, use this option.
=back
=head2 Debug Options
There are a number of debug options that will give you lots of extra information (albeit in a less pretty format).
=over
=item C<-O>
Show the API reponse output. Always in JSON format. JSON is pretty-printed.
=item C<-H>
Show the API response headers.
=item C<-J>
Show the API response JSON, in decoded form.
=item C<-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).
=item C<-x>
Turn on Bash C<-x> debugging. This will show every bash command executed in the program. This is extremely useful to track down nasty bugs.
=back
=head1 Arguments
The C
=over
=item * Commandline B
=item * Environment variables of the form C
=item * The C<./.git/config> file. (The repo you are issuing commands from)
=item * The C<~/.git-hub/config> file.
=back
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: C<<
=over
=item C<<
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.
B
=item C<<
A GitHub user or organization that owns the repository being specified. This
value defaults much like the C<<
=item C<<
A GitHub organization name. B
=item C<<
A GitHub repository name. If this argument is optional, it defaults to the
GitHub repo name of the repo you are currently in. B
=item C<<
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 C, instead of C<me/myrepo>. If this argument is optional, it defaults the the owner and repo of the GitHub repo you are in.
=item C<<
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.
=item C<<
The integer number B
=item C<<
One of the GitHub scopes that you can apply to a token. The C
=back
=head1 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.
=over
=item C
Show this manpage.
=item C
Print version info for C
=item C
Show detailed version and environment info about your C
=item C
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 L<#Configuration-Commands> below.
=item C
Upgrade the C
=item C<< 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 C<--raw> and C<--json> options show the data in different formats than normal output.
=item C<< user-get
Get a specific data value for a particular user.
=item C<< user-edit
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: C
=item C<< orgs [
List the organizations that a user is a member of.
=item C<< org
Show basic information about a GitHub organization. The C<--raw> and C<--json> options show the data in different formats than normal output.
=item C<< org-repos
Show all the repos for an organization, both public and private.
=item C<< org-members
List members of an organization.
=item C<< org-get
Get a specific data value for a particular organization.
=item C<< org-edit
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: C
=item C<< teams
List the teams in an organization.
=item C<< team
Get information about a team.
=item C<< team-members
List members of a team.
=item C<< team-repos
List repos of a team.
=item C<< team-repo-add
Add repo to a team. Repo name must not include org name.
=item C<< team-new
Add a new team (name) to an organization. The 'perm' arg must be pull, push or admin.
=item C<< team-delete
Delete a team.
=item C<< members
List the members of an organization or team. If numeric argument, show team members, else organization members.
=item C<< member-get
Show whether a user is a member of a specified team.
=item C<< member-add
Add a user to a team.
=item C<< member-remove
Remove a user from a team.
=item C<< followers [
List the people who are followers of a user.
=item C<< follows
Check if C<<
=item C<< following [
List the people that a user is following.
=item C<< follow
Follow one or more users.
=item C<< unfollow
Stop following one or more users.
=item C<< clone ([
Clone a GitHub repo. Always uses C<--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 '.I<' or '..>' so that it can be distinguished from another repo name.
=item C<< repos [
List the repos for a user or organization. List is returned in order of recent activity.
=item C<< repo [
Show basic information about a specific repository. The C<--raw> and C<--json> options show the data in different formats than normal output.
=item C<< repo-get
Get a specific data value for a particular repository.
=item C<< repo-edit [
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: C
=item C<< repo-new [
Create a new GitHub repository.
=item C<< repo-init [
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.
=item C<< repo-delete
Delete a GitHub repository.
=item C<< forks [
List the forks of a repository.
=item C<< fork
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.
=item C<< stars [
Show what users have starred a repository.
=item C<< star [
Add your B
=item C<< unstar [
Remove your B
=item C<< starred [
List repositories that a user has starred.
=item C<< watch [
Start watching a repo.
=item C<< unwatch [
Stop watching a repo.
=item C<< watching [
Show which repos a user is watching.
=item C<< watchers [
Show the users who are watching a repo.
=item C<< collabs [
List current collaborators for a repository.
=item C<< trust [
Add one or more collaborators to a repository.
=item C<< untrust [
Remove one or more collaborators from a repository.
=item C<< issues [
List the open issues for a repo. Use the C<--all> flag to see both open and closed issues.
=item C<< issue [
Show info (including any comments) for a specific issue. If no issue number is
given, this command will call C
=item C<< issue-new [
Create a new issue for a repository.
=item C<< issue-edit [
Add a comment. Change values of 'title', 'state', 'assignee' and 'milestone'. Changing state to 'closed' will close the issue.
=item C<< comment [
Add a comment to an issue. You can also use C
=item C<< issue-close [
Close an issue. You can also use C
=item C<< issue-resolve [
Add a comment to an issue and then close it.
=item C<< pr-list [
List the pull requests for a repo.
=item C<< pr-new [
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 C<--remote>, C<--branch>, C<--parent>, and C<--base> options to change the default source remote, source branch, target remote and target branch (respectively).
This command will open an editor like C
=item C<< pr-diff [
Show the diff for a pull request.
=item C<< pr-fetch [
Fetches a pull request to a local C<review/$number> branch
=item C<< pr-merge [
Merge and close a pull request.
It supports the following options:
=over
=item * C<--sha>
=item * C<--merge-method>
=item * C<--commit-title>
=item * C<--commit-message>
=back
=item C<< pr-queue [
Show a user's Pull Request queue, for all repos. Shows the open PRs for any repo that has them. The C<--all> option says to show closed as well as open PRs. Results are sorted by date of creation.
=item C<< pr-created [
Show a list of Pull Requests the user created, for all repos. Shows the open PRs for any repo that has them. The C<--all> option says to show closed as well as open PRs. Results are sorted by date of creation.
=item C<< pr-involves [
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 C<--all> option says to show closed as well as open PRs. Results are sorted by date of creation.
=item C<notify-list [--all]>
List your recent I
=item C<< keys [
List public SSH keys for a user.
=item C<< keys-add
Add a public ssh key for your user.
=item C
Clear your API response cache.
=item C<< open [
Open a browser window to a repo or a file in a repo.
=item C<< url [
Print the URL of a repo or a file in a repo.
=item C
Enable and/or disable travis-ci testing from the command line.
=item C<< gists [
List gists for a user.
=item C<< gist
Show info about gist.
=item C<< gist-get
Get a specific data value for a particular gist.
=item C<< gist-edit
Set specific meta-data fields of a gist to new values. You list the parameters as key/value pairs.
=item C<< gist-star
Add your B
=item C<< gist-unstar
Remove your B
=item C<< gist-delete
Delete a gist.
=item C<< gist-clone
Clone a gist.
=item C<< gist-fork
Fork a gist.
=item C<< gist-new (public|secret)
Create a gist from existing files
=item C<< gist-init (public|secret)
Create an (almost) empty gist and clone it
This will create a gist with a file '.gitignore'
=item C<< search-repo
Search for repositories.
By default it searches in the repository name, but you can change that: C<search-repo "libyaml in:description">. For more information, see the search documentation at Lhttps://developer.github.com/v3/search/#search-repositories
=item C<< search-user
Search for users.
By default it searches in the login field, but you can change that: C<search-user "wall in:fullname">. For more information, see the search documentation at Lhttps://developer.github.com/v3/search/#search-users
=item C<< search-issues
Search for issues and pull requests. For more information, see the search documentation at Lhttps://developer.github.com/v3/search/#search-users
=back
=head2 Plugin Commands
You get tons of useful commands by default, and they are all listed and
documented in the next section below. But C
This section is about the "plugin" commands that currently come with
C
=over
=item C<< irc-enable
This command must be run inside a cloned repo. It enables GitHub activities for a repo to be reported to an IRC channel.
=item C
This command must be run inside a cloned repo. It disables the GitHub IRC webhook for a repo.
=item C
Show the GitHub URL for setting webhooks on the current repo.
=back
=head2 Configuration Commands
These commands are for editing your C
=over
=item C<< config [
With no args, this command will print the contents of C<~/.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: C
=item C<< config-unset
Unset a config key. Removes the key from the C<~/.git-hub/config> file.
=item C
Will list your current configuration like C<git config --list>
=item C
Output all possible configuration keys
=item C
List all the API tokens for your GitHub account. Use the C<--raw> option to print the token IDs and descriptions, but not the actual token values.
=item C<< token-new [
Create a new API token for your GitHub login id. Note: Creating a new token
will not automatically add it to your C<~/.git-hub/config> file; you need to
do that yourself with the C<< git hub config api-token
=item C<< token-get
Get a specific data value for a particular token.
=item C<< token-delete
Delete one of your API tokens for your GitHub login id. Note: You need to
delete tokens by B
=item C<< scopes
List the scopes assigned to your API token, and also list all the possible scope values that you can assign. Use the C<--raw> option to just list the scopes.
=item C<< scope-add
Add one or more scopes to your API token. You can use the C<--all> option to add all possible scopes at once.
=item C<< scope-remove
Remove one or more scopes from your API token. You can use the C<--all> option to remove all possible scopes at once.
=back
=head1 Upgrading git-hub
If you used the C
git hub upgrade
Or (same thing):
cd /path/to/git-hub
git pull
If you used C
make install # Possibly with 'sudo'
=head1 Command Completion
The C
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.
=head2 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
=head2 Completing user names as part of the full repository name
For completing usernames, you have to type a C<@> and at least two characters.
C<< git hub repo @in
The C<@> will automatically go away if there is only one matching user, or if you add a C</> after it.
git hub repo @ingyd<TAB> -> git hub repo ingydotnet/
git hub repo @ingydotnet/<TAB> -> git hub repo ingydotnet/
=head2 Completing user names for commands like follow, user, trust
This is not supported yet.
=head2 Enabling completion
=head3 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):
=over
=item * C</etc/bash_completion.d/git>
=item * C</usr/share/bash-completion/git>
=item * C</usr/share/bash-completion/completions/git>
=item * C</opt/local/share/bash-completion/completions/git>
=item * C</usr/local/etc/bash_completion.d/git>
=item * C</usr/local/opt/git/share/git-core/contrib/completion>
=item * C<~/.homebrew/etc/bash_completion.d/git>
=back
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 C
source /path/to/git-hub/share/completion.bash
=head3 In zsh
In the Z shell (zsh), you can manually enable C
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
=head1 Plugins
The C
=head1 Faster
The C
To make the C
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.
=head1 Pipe and Each
You can pipe the output of one C
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.
=head1 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 C
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 L<thispage|https://github.com/settings/applications>.
You can specify your API token to C
Certain token B
NOTE: All the C
=head1 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 C<-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
=head1 ETAG Caching
GitHub provides ETag headers in the API responses, and C
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:
=over
=item * Use the C<-C> (C<--no-cache>) flag on a request to bypass the cache.
=item * Set C
=item * Run C
=item * Run C
=back
=head1 Colors
You can have colored output. You can activate that by setting C
=head1 Examples
The following sections show lots of interesting ways to use C
=head2 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 C
To just create a new github repo without cloning it, use C
=head2 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 C
=head2 Example 3. Building Complex Commands
The C
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 -
=head1 Author
Written by Ingy döt Net ingy@ingy.net
=head1 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 C<notes/todo> in the C
Try C
Find 'ingy' on #gitcommands in irc.freenode.net if you have questions or ideas.
=head1 Copyright & License
Copyright 2013-2016. Ingy döt Net.
The MIT License (MIT)
=cut