.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "HUB" "1" "November 2016" "GITHUB" "Hub Manual" . .SH "NAME" \fBhub\fR \- git + hub = github . .SH "SYNOPSIS" \fBhub\fR [\fB\-\-noop\fR] \fICOMMAND\fR \fIOPTIONS\fR . .br \fBhub alias\fR [\fB\-s\fR] [\fISHELL\fR] . .SS "Expanded git commands:" \fBgit init \-g\fR \fIOPTIONS\fR . .br \fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR . .br \fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR] . .br \fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR] . .br \fBgit fetch\fR \fIUSER\-1\fR,[\fIUSER\-2\fR,\.\.\.] . .br \fBgit checkout\fR \fIPULLREQ\-URL\fR [\fIBRANCH\fR] . .br \fBgit merge\fR \fIPULLREQ\-URL\fR . .br \fBgit cherry\-pick\fR \fIGITHUB\-REF\fR . .br \fBgit am\fR \fIGITHUB\-URL\fR . .br \fBgit apply\fR \fIGITHUB\-URL\fR . .br \fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,\.\.\.,\fIREMOTE\-N\fR [\fIREF\fR] . .br \fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR . .SS "Custom git commands:" \fBgit create\fR [\fINAME\fR] [\fB\-p\fR] [\fB\-d\fR \fIDESCRIPTION\fR] [\fB\-h\fR \fIHOMEPAGE\fR] . .br \fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE] . .br \fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [[\fISTART\fR\.\.\.]\fIEND\fR] . .br \fBgit fork\fR [\fB\-\-no\-remote\fR] . .br \fBgit pull\-request\fR [\fB\-o\fR|\fB\-\-browse\fR] [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] . .br \fBgit ci\-status\fR [\fB\-v\fR] [\fICOMMIT\fR] . .SH "DESCRIPTION" hub enhances various git commands to ease most common workflows with GitHub\. . .TP \fBhub \-\-noop\fR \fICOMMAND\fR Shows which command(s) would be run as a result of the current command\. Doesn\'t perform anything\. . .TP \fBhub alias\fR [\fB\-s\fR] [\fISHELL\fR] Shows shell instructions for wrapping git\. If given, \fISHELL\fR specifies the type of shell; otherwise defaults to the value of SHELL environment variable\. With \fB\-s\fR, outputs shell script suitable for \fBeval\fR\. . .TP \fBgit init\fR \fB\-g\fR \fIOPTIONS\fR Create a git repository as with git\-init(1) and add remote \fBorigin\fR at "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"; \fIUSER\fR is your GitHub username and \fIREPOSITORY\fR is the current working directory\'s basename\. . .TP \fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR Clone repository "git://github\.com/\fIUSER\fR/\fIREPOSITORY\fR\.git" into \fIDIRECTORY\fR as with git\-clone(1)\. When \fIUSER\fR/ is omitted, assumes your GitHub login\. . .IP If the repository is private or the current user has push access to the repository, hub will use the ssh protocol for cloning\. Use \fB\-p\fR to select the ssh protocol unconditionally\. HTTPS protocol can be used instead by setting "hub\.protocol" (see \fICONFIGURATION\fR)\. . .TP \fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR] Add remote "git://github\.com/\fIUSER\fR/\fIREPOSITORY\fR\.git" as with git\-remote(1)\. When /\fIREPOSITORY\fR is omitted, the basename of the current working directory is used\. With \fB\-p\fR, use private remote "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"\. If \fIUSER\fR is "origin" then uses your GitHub login\. . .TP \fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR] Sets the url of remote \fIREMOTE\-NAME\fR using the same rules as \fBgit remote add\fR\. . .TP \fBgit fetch\fR \fIUSER\-1\fR,[\fIUSER\-2\fR,\.\.\.] Adds missing remote(s) with \fBgit remote add\fR prior to fetching\. New remotes are only added if they correspond to valid forks on GitHub\. . .TP \fBgit checkout\fR \fIPULLREQ\-URL\fR [\fIBRANCH\fR] Checks out the head of the pull request as a local branch, to allow for reviewing, rebasing and otherwise cleaning up the commits in the pull request before merging\. The name of the local branch can explicitly be set with \fIBRANCH\fR\. . .TP \fBgit merge\fR \fIPULLREQ\-URL\fR Merge the pull request with a commit message that includes the pull request ID and title, similar to the GitHub Merge Button\. . .TP \fBgit cherry\-pick\fR \fIGITHUB\-REF\fR Cherry\-pick a commit from a fork using either full URL to the commit or GitHub\-flavored Markdown notation, which is \fBuser@sha\fR\. If the remote doesn\'t yet exist, it will be added\. A \fBgit fetch \fR is issued prior to the cherry\-pick attempt\. . .TP \fBgit [am|apply]\fR \fIGITHUB\-URL\fR Downloads the patch file for the pull request or commit at the URL and applies that patch from disk with \fBgit am\fR or \fBgit apply\fR\. Similar to \fBcherry\-pick\fR, but doesn\'t add new remotes\. \fBgit am\fR creates commits while preserving authorship info while \fBapply\fR only applies the patch to the working copy\. . .TP \fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,\.\.\.,\fIREMOTE\-N\fR [\fIREF\fR] Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing multiple \fBgit push\fR commands\. . .TP \fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR Submodule repository "git://github\.com/\fIUSER\fR/\fIREPOSITORY\fR\.git" into \fIDIRECTORY\fR as with git\-submodule(1)\. When \fIUSER\fR/ is omitted, assumes your GitHub login\. With \fB\-p\fR, use private remote "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"\. . .TP \fBgit help\fR Display enhanced git\-help(1)\. . .P hub also adds some custom commands that are otherwise not present in git: . .TP \fBgit create\fR [\fINAME\fR] [\fB\-p\fR] [\fB\-d\fR \fIDESCRIPTION\fR] [\fB\-h\fR \fIHOMEPAGE\fR] Create a new public GitHub repository from the current git repository and add remote \fBorigin\fR at "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"; \fIUSER\fR is your GitHub username and \fIREPOSITORY\fR is the current working directory name\. To explicitly name the new repository, pass in \fINAME\fR, optionally in \fIORGANIZATION\fR/\fINAME\fR form to create under an organization you\'re a member of\. With \fB\-p\fR, create a private repository, and with \fB\-d\fR and \fB\-h\fR set the repository\'s description and homepage URL, respectively\. . .TP \fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE] Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\. A specific commit in the default repository can be opened with \fBgit browse \-\- commit/\fR\. With \fB\-u\fR, outputs the URL rather than opening the browser\. . .TP \fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [[\fISTART\fR\.\.\.]\fIEND\fR] Open a GitHub compare view page in the system\'s default web browser\. \fISTART\fR to \fIEND\fR are branch names, tag names, or commit SHA1s specifying the range of history to compare\. If a range with two dots (\fBa\.\.b\fR) is given, it will be transformed into one with three dots\. If \fISTART\fR is omitted, GitHub will compare against the base branch (the default is "master")\. If \fIEND\fR is omitted, GitHub compare view is opened for the current branch\. With \fB\-u\fR, outputs the URL rather than opening the browser\. . .TP \fBgit fork\fR [\fB\-\-no\-remote\fR] Forks the original project (referenced by "origin" remote) on GitHub and adds a new remote for it under your username\. . .TP \fBgit pull\-request\fR [\fB\-o\fR|\fB\-\-browse\fR] [\fB\-f\fR] [\fB\-m\fR \fIMESSAGE\fR|\fB\-F\fR \fIFILE\fR|\fB\-i\fR \fIISSUE\fR|\fIISSUE\-URL\fR] [\fB\-b\fR \fIBASE\fR] [\fB\-h\fR \fIHEAD\fR] Opens a pull request on GitHub for the project that the "origin" remote points to\. The default head of the pull request is the current branch\. Both base and head of the pull request can be explicitly given in one of the following formats: "branch", "owner:branch", "owner/repo:branch"\. This command will abort operation if it detects that the current topic branch has local commits that are not yet pushed to its upstream branch on the remote\. To skip this check, use \fB\-f\fR\. . .IP Without \fIMESSAGE\fR or \fIFILE\fR, a text editor will open in which title and body of the pull request can be entered in the same manner as git commit message\. Pull request message can also be passed via stdin with \fB\-F \-\fR\. . .IP With \fB\-o\fR or \fB\-\-browse\fR, the new pull request will open in the web browser\. . .IP Issue to pull request conversion via \fB\-i \fR or \fIISSUE\-URL\fR arguments is deprecated and will likely be removed from the future versions of both hub and GitHub API\. . .TP \fBgit ci\-status\fR [\fB\-v\fR] [\fICOMMIT\fR] Looks up the SHA for \fICOMMIT\fR in GitHub Status API and displays the latest status\. Exits with one of: . .br success (0), error (1), failure (1), pending (2), no status (3) . .IP If \fB\-v\fR is given, additionally print detailed report of all checks and their URLs\. . .SH "CONFIGURATION" . .SS "GitHub OAuth authentication" Hub will prompt for GitHub username & password the first time it needs to access the API and exchange it for an OAuth token, which it saves in "~/\.config/hub"\. . .P To avoid being prompted, use \fIGITHUB_USER\fR and \fIGITHUB_PASSWORD\fR environment variables\. . .P Alternatively, you may provide \fIGITHUB_TOKEN\fR, an access token with \fIrepo\fR permissions\. This will not be written to \fB~/\.config/hub\fR\. . .SS "HTTPS instead of git protocol" If you prefer the HTTPS protocol for GitHub repositories, you can set "hub\.protocol" to "https"\. This will affect \fBclone\fR, \fBfork\fR, \fBremote add\fR and other operations that expand references to GitHub repositories as full URLs that otherwise use git and ssh protocols\. . .P "hub\.protocol" only applies when the "OWNER/REPO" shorthand is used instead of a full git URL\. . .IP "" 4 . .nf # default behavior $ git clone defunkt/repl < git clone > # opt into HTTPS: $ git config \-\-global hub\.protocol https $ git clone defunkt/repl < https clone > . .fi . .IP "" 0 . .SS "GitHub Enterprise" By default, hub will only work with repositories that have remotes which point to github\.com\. GitHub Enterprise hosts need to be whitelisted to configure hub to treat such remotes same as github\.com: . .IP "" 4 . .nf $ git config \-\-global \-\-add hub\.host my\.git\.org . .fi . .IP "" 0 . .P The default host for commands like \fBinit\fR and \fBclone\fR is still github\.com, but this can be affected with the \fBGITHUB_HOST\fR environment variable: . .IP "" 4 . .nf $ GITHUB_HOST=my\.git\.org git clone myproject . .fi . .IP "" 0 . .SH "EXAMPLES" . .SS "git clone" . .nf $ git clone schacon/ticgit > git clone git://github\.com/schacon/ticgit\.git $ git clone \-p schacon/ticgit > git clone git@github\.com:schacon/ticgit\.git $ git clone resque > git clone git@github\.com:YOUR_USER/resque\.git . .fi . .SS "git remote add" . .nf $ git remote add rtomayko > git remote add rtomayko git://github\.com/rtomayko/CURRENT_REPO\.git $ git remote add \-p rtomayko > git remote add rtomayko git@github\.com:rtomayko/CURRENT_REPO\.git $ git remote add origin > git remote add origin git://github\.com/YOUR_USER/CURRENT_REPO\.git . .fi . .SS "git fetch" . .nf $ git fetch mislav > git remote add mislav git://github\.com/mislav/REPO\.git > git fetch mislav $ git fetch mislav,xoebus > git remote add mislav \.\.\. > git remote add xoebus \.\.\. > git fetch \-\-multiple mislav xoebus . .fi . .SS "git cherry\-pick" . .nf $ git cherry\-pick http://github\.com/mislav/REPO/commit/SHA > git remote add \-f \-\-no\-tags mislav git://github\.com/mislav/REPO\.git > git cherry\-pick SHA $ git cherry\-pick mislav@SHA > git remote add \-f \-\-no\-tags mislav git://github\.com/mislav/CURRENT_REPO\.git > git cherry\-pick SHA $ git cherry\-pick mislav@SHA > git fetch mislav > git cherry\-pick SHA . .fi . .SS "git am, git apply" . .nf $ git am https://github\.com/defunkt/hub/pull/55 [ downloads patch via API ] > git am /tmp/55\.patch $ git am \-\-ignore\-whitespace https://github\.com/davidbalbert/hub/commit/fdb9921 [ downloads patch via API ] > git am \-\-ignore\-whitespace /tmp/fdb9921\.patch $ git apply https://gist\.github\.com/8da7fb575debd88c54cf [ downloads patch via API ] > git apply /tmp/gist\-8da7fb575debd88c54cf\.txt . .fi . .SS "git fork" . .nf $ git fork [ repo forked on GitHub ] > git remote add \-f YOUR_USER git@github\.com:YOUR_USER/CURRENT_REPO\.git . .fi . .SS "git pull\-request" . .nf # while on a topic branch called "feature": $ git pull\-request [ opens text editor to edit title & body for the request ] [ opened pull request on GitHub for "YOUR_USER:feature" ] # explicit title, pull base & head: $ git pull\-request \-m "Implemented feature X" \-b defunkt:master \-h mislav:feature . .fi . .SS "git checkout" . .nf $ git checkout https://github\.com/defunkt/hub/pull/73 > git remote add \-f \-\-no\-tags \-t feature mislav git://github\.com/mislav/hub\.git > git checkout \-\-track \-B mislav\-feature mislav/feature $ git checkout https://github\.com/defunkt/hub/pull/73 custom\-branch\-name . .fi . .SS "git merge" . .nf $ git merge https://github\.com/defunkt/hub/pull/73 > git fetch git://github\.com/mislav/hub\.git +refs/heads/feature:refs/remotes/mislav/feature > git merge mislav/feature \-\-no\-ff \-m \'Merge pull request #73 from mislav/feature\.\.\.\' . .fi . .SS "git create" . .nf $ git create [ repo created on GitHub ] > git remote add origin git@github\.com:YOUR_USER/CURRENT_REPO\.git # with description: $ git create \-d \'It shall be mine, all mine!\' $ git create recipes [ repo created on GitHub ] > git remote add origin git@github\.com:YOUR_USER/recipes\.git $ git create sinatra/recipes [ repo created in GitHub organization ] > git remote add origin git@github\.com:sinatra/recipes\.git . .fi . .SS "git init" . .nf $ git init \-g > git init > git remote add origin git@github\.com:YOUR_USER/REPO\.git . .fi . .SS "git push" . .nf $ git push origin,staging,qa bert_timeout > git push origin bert_timeout > git push staging bert_timeout > git push qa bert_timeout . .fi . .SS "git browse" . .nf $ git browse > open https://github\.com/YOUR_USER/CURRENT_REPO $ git browse \-\- commit/SHA > open https://github\.com/YOUR_USER/CURRENT_REPO/commit/SHA $ git browse \-\- issues > open https://github\.com/YOUR_USER/CURRENT_REPO/issues $ git browse \-\- issues/10 > open https://github\.com/YOUR_USER/CURRENT_REPO/issues/10 $ git browse schacon/ticgit > open https://github\.com/schacon/ticgit $ git browse schacon/ticgit commit/SHA > open https://github\.com/schacon/ticgit/commit/SHA $ git browse resque > open https://github\.com/YOUR_USER/resque $ git browse resque network > open https://github\.com/YOUR_USER/resque/network . .fi . .SS "git compare" . .nf $ git compare refactor > open https://github\.com/CURRENT_REPO/compare/refactor $ git compare 1\.0\.\.1\.1 > open https://github\.com/CURRENT_REPO/compare/1\.0\.\.\.1\.1 $ git compare \-u fix > (https://github\.com/CURRENT_REPO/compare/fix) $ git compare other\-user patch > open https://github\.com/other\-user/REPO/compare/patch . .fi . .SS "git submodule" . .nf $ git submodule add wycats/bundler vendor/bundler > git submodule add git://github\.com/wycats/bundler\.git vendor/bundler $ git submodule add \-p wycats/bundler vendor/bundler > git submodule add git@github\.com:wycats/bundler\.git vendor/bundler $ git submodule add \-b ryppl \-\-name pip ryppl/pip vendor/pip > git submodule add \-b ryppl \-\-name pip git://github\.com/ryppl/pip\.git vendor/pip . .fi . .SS "git ci\-status" . .nf $ git ci\-status [commit] > (prints CI state of commit and exits with appropriate code) > One of: success (0), error (1), failure (1), pending (2), no status (3) . .fi . .SS "git help" . .nf $ git help > (improved git help) $ git help hub > (hub man page) . .fi . .SH "BUGS" \fIhttps://github\.com/github/hub/issues\fR . .SH "AUTHORS" \fIhttps://github\.com/github/hub/contributors\fR . .SH "SEE ALSO" git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github\.com\fR, \fIhttps://github\.com/github/hub\fR