Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

450 lines (352 sloc) 20.813 kb
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='content-type' value='text/html;charset=utf8'>
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
<title>hub(1) - git + hub = github</title>
<style type='text/css' media='all'>
/* style: man */
body#manpage {margin:0}
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
.mp h2 {margin:10px 0 0 0}
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
.mp h3 {margin:0 0 0 4ex}
.mp dt {margin:0;clear:left}
.mp dt.flush {float:left;width:8ex}
.mp dd {margin:0 0 0 9ex}
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
.mp pre {margin-bottom:20px}
.mp pre+h2,.mp pre+h3 {margin-top:22px}
.mp h2+pre,.mp h3+pre {margin-top:5px}
.mp img {display:block;margin:auto}
.mp h1.man-title {display:none}
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
.mp h2 {font-size:16px;line-height:1.25}
.mp h1 {font-size:20px;line-height:2}
.mp {text-align:justify;background:#fff}
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
.mp u {text-decoration:underline}
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
.mp b.man-ref {font-weight:normal;color:#434241}
.mp pre {padding:0 4ex}
.mp pre code {font-weight:normal;color:#434241}
.mp h2+pre,h3+pre {padding-left:0}
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
ol.man-decor {width:100%}
ol.man-decor li.tl {text-align:left}
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
ol.man-decor li.tr {text-align:right;float:right}
</style>
</head>
<!--
The following styles are deprecated and will be removed at some point:
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
.man-navigation should be used instead.
-->
<body id='manpage'>
<div class='mp' id='man'>
<div class='man-navigation' style='display:none'>
<a href="#NAME">NAME</a>
<a href="#SYNOPSIS">SYNOPSIS</a>
<a href="#DESCRIPTION">DESCRIPTION</a>
<a href="#CONFIGURATION">CONFIGURATION</a>
<a href="#EXAMPLES">EXAMPLES</a>
<a href="#BUGS">BUGS</a>
<a href="#AUTHORS">AUTHORS</a>
<a href="#SEE-ALSO">SEE ALSO</a>
</div>
<ol class='man-decor man-head man head'>
<li class='tl'>hub(1)</li>
<li class='tc'>Git Manual</li>
<li class='tr'>hub(1)</li>
</ol>
<h2 id="NAME">NAME</h2>
<p class="man-name">
<code>hub</code> - <span class="man-whatis">git + hub = github</span>
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>hub</code> [<code>--noop</code>] <var>COMMAND</var> <var>OPTIONS</var><br />
<code>hub alias</code> [<code>-s</code>] [<var>SHELL</var>]</p>
<h3 id="Expanded-git-commands-">Expanded git commands:</h3>
<p><code>git init -g</code> <var>OPTIONS</var><br />
<code>git clone</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var><br />
<code>git remote add</code> [<code>-p</code>] <var>OPTIONS</var> <var>USER</var>[/<var>REPOSITORY</var>]<br />
<code>git remote set-url</code> [<code>-p</code>] <var>OPTIONS</var> <var>REMOTE-NAME</var> <var>USER</var>[/<var>REPOSITORY</var>]<br />
<code>git fetch</code> <var>USER-1</var>,[<var>USER-2</var>,...]<br />
<code>git checkout</code> <var>PULLREQ-URL</var> [<var>BRANCH</var>]<br />
<code>git merge</code> <var>PULLREQ-URL</var><br />
<code>git cherry-pick</code> <var>GITHUB-REF</var><br />
<code>git am</code> <var>GITHUB-URL</var><br />
<code>git apply</code> <var>GITHUB-URL</var><br />
<code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> [<var>REF</var>]<br />
<code>git submodule add</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var></p>
<h3 id="Custom-git-commands-">Custom git commands:</h3>
<p><code>git create</code> [<var>NAME</var>] [<code>-p</code>] [<code>-d</code> <var>DESCRIPTION</var>] [<code>-h</code> <var>HOMEPAGE</var>]<br />
<code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]<br />
<code>git compare</code> [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var><br />
<code>git fork</code> [<code>--no-remote</code>]<br />
<code>git pull-request</code> [<code>-f</code>] [<var>TITLE</var>|<code>-i</code> <var>ISSUE</var>] [<code>-b</code> <var>BASE</var>] [<code>-h</code> <var>HEAD</var>]</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p>hub enhances various git commands to ease most common workflows with GitHub.</p>
<dl>
<dt><code>hub --noop</code> <var>COMMAND</var></dt><dd><p>Shows which command(s) would be run as a result of the current command.
Doesn't perform anything.</p></dd>
<dt><code>hub alias</code> [<code>-s</code>] [<var>SHELL</var>]</dt><dd><p>Shows shell instructions for wrapping git. If given, <var>SHELL</var> specifies the
type of shell; otherwise defaults to the value of SHELL environment
variable. With <code>-s</code>, outputs shell script suitable for <code>eval</code>.</p></dd>
<dt><code>git init</code> <code>-g</code> <var>OPTIONS</var></dt><dd><p>Create a git repository as with <span class="man-ref">git-init<span class="s">(1)</span></span> and add remote <code>origin</code> at
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git"; <var>USER</var> is your GitHub username and
<var>REPOSITORY</var> is the current working directory's basename.</p></dd>
<dt><code>git clone</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var><code>/</code>]<var>REPOSITORY</var> <var>DIRECTORY</var></dt><dd><p>Clone repository "git://github.com/<var>USER</var>/<var>REPOSITORY</var>.git" into
<var>DIRECTORY</var> as with <span class="man-ref">git-clone<span class="s">(1)</span></span>. When <var>USER</var>/ is omitted, assumes
your GitHub login. With <code>-p</code>, clone private repositories over SSH.
For repositories under your GitHub login, <code>-p</code> is implicit.</p></dd>
<dt><code>git remote add</code> [<code>-p</code>] <var>OPTIONS</var> <var>USER</var>[<code>/</code><var>REPOSITORY</var>]</dt><dd><p>Add remote "git://github.com/<var>USER</var>/<var>REPOSITORY</var>.git" as with
<span class="man-ref">git-remote<span class="s">(1)</span></span>. When /<var>REPOSITORY</var> is omitted, the basename of the
current working directory is used. With <code>-p</code>, use private remote
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git". If <var>USER</var> is "origin"
then uses your GitHub login.</p></dd>
<dt><code>git remote set-url</code> [<code>-p</code>] <var>OPTIONS</var> <var>REMOTE-NAME</var> <var>USER</var>[/<var>REPOSITORY</var>]</dt><dd><p>Sets the url of remote <var>REMOTE-NAME</var> using the same rules as
<code>git remote add</code>.</p></dd>
<dt><code>git fetch</code> <var>USER-1</var>,[<var>USER-2</var>,...]</dt><dd><p>Adds missing remote(s) with <code>git remote add</code> prior to fetching. New
remotes are only added if they correspond to valid forks on GitHub.</p></dd>
<dt><code>git checkout</code> <var>PULLREQ-URL</var> [<var>BRANCH</var>]</dt><dd><p>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 <var>BRANCH</var>.</p></dd>
<dt><code>git merge</code> <var>PULLREQ-URL</var></dt><dd><p>Merge the pull request with a commit message that includes the pull request
ID and title, similar to the GitHub Merge Button.</p></dd>
<dt><code>git cherry-pick</code> <var>GITHUB-REF</var></dt><dd><p>Cherry-pick a commit from a fork using either full URL to the commit
or GitHub-flavored Markdown notation, which is <code>user@sha</code>. If the remote
doesn't yet exist, it will be added. A <code>git fetch &lt;user></code> is issued
prior to the cherry-pick attempt.</p></dd>
<dt><code>git [am|apply]</code> <var>GITHUB-URL</var></dt><dd><p>Downloads the patch file for the pull request or commit at the URL and
applies that patch from disk with <code>git am</code> or <code>git apply</code>. Similar to
<code>cherry-pick</code>, but doesn't add new remotes. <code>git am</code> creates commits while
preserving authorship info while <code>apply</code> only applies the patch to the
working copy.</p></dd>
<dt><code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> [<var>REF</var>]</dt><dd><p>Push <var>REF</var> to each of <var>REMOTE-1</var> through <var>REMOTE-N</var> by executing
multiple <code>git push</code> commands.</p></dd>
<dt><code>git submodule add</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var></dt><dd><p>Submodule repository "git://github.com/<var>USER</var>/<var>REPOSITORY</var>.git" into
<var>DIRECTORY</var> as with <span class="man-ref">git-submodule<span class="s">(1)</span></span>. When <var>USER</var>/ is omitted, assumes
your GitHub login. With <code>-p</code>, use private remote
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git".</p></dd>
<dt><code>git help</code></dt><dd><p>Display enhanced <span class="man-ref">git-help<span class="s">(1)</span></span>.</p></dd>
</dl>
<p>hub also adds some custom commands that are otherwise not present in git:</p>
<dl>
<dt><code>git create</code> [<var>NAME</var>] [<code>-p</code>] [<code>-d</code> <var>DESCRIPTION</var>] [<code>-h</code> <var>HOMEPAGE</var>]</dt><dd><p>Create a new public GitHub repository from the current git
repository and add remote <code>origin</code> at
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git"; <var>USER</var> is your GitHub
username and <var>REPOSITORY</var> is the current working directory name.
To explicitly name the new repository, pass in <var>NAME</var>, optionally in
<var>ORGANIZATION</var>/<var>NAME</var> form to create under an organization you're a
member of. With <code>-p</code>, create a private repository, and with <code>-d</code> and <code>-h</code>
set the repository's description and homepage URL, respectively.</p></dd>
<dt><code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]</dt><dd><p>Open repository's GitHub page in the system's default web browser using
<code>open(1)</code> or the <code>BROWSER</code> env variable. If the repository isn't
specified, <code>browse</code> 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").</p></dd>
<dt><code>git compare</code> [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var></dt><dd><p>Open a GitHub compare view page in the system's default web browser.
<var>START</var> to <var>END</var> are branch names, tag names, or commit SHA1s specifying
the range of history to compare. If a range with two dots (<code>a..b</code>) is given,
it will be transformed into one with three dots. If <var>START</var> is omitted,
GitHub will compare against the base branch (the default is "master").</p></dd>
<dt><code>git fork</code> [<code>--no-remote</code>]</dt><dd><p>Forks the original project (referenced by "origin" remote) on GitHub and
adds a new remote for it under your username.</p></dd>
<dt><code>git pull-request</code> [<code>-f</code>] [<var>TITLE</var>|<code>-i</code> <var>ISSUE</var>|<var>ISSUE-URL</var>] [<code>-b</code> <var>BASE</var>] [<code>-h</code> <var>HEAD</var>]</dt><dd><p>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 <code>-f</code>.</p>
<p>If <var>TITLE</var> is omitted, 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.</p>
<p>If instead of normal <var>TITLE</var> an issue number is given with <code>-i</code>, the pull
request will be attached to an existing GitHub issue. Alternatively, instead
of title you can paste a full URL to an issue on GitHub.</p></dd>
</dl>
<h2 id="CONFIGURATION">CONFIGURATION</h2>
<p>Hub will prompt for GitHub username &amp; password the first time it needs to access
the API and exchange it for an OAuth token, which it saves in "~/.config/hub".</p>
<p>To avoid being prompted, use <var>GITHUB_USER</var> and <var>GITHUB_PASSWORD</var> environment
variables.</p>
<p>If you prefer the HTTPS protocol for GitHub repositories, you can set
"hub.protocol" to "https". This will affect <code>clone</code>, <code>fork</code>, <code>remote add</code>
and other operations that expand references to GitHub repositories as full
URLs that otherwise use git and ssh protocols.</p>
<pre><code>$ git config --global hub.protocol https
</code></pre>
<h3 id="GitHub-Enterprise">GitHub Enterprise</h3>
<p>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:</p>
<pre><code>$ git config --global --add hub.host my.git.org
</code></pre>
<p>The default host for commands like <code>init</code> and <code>clone</code> is still
github.com, but this can be affected with the <var>GITHUB_HOST</var> environment
variable:</p>
<pre><code>$ GITHUB_HOST=my.git.org git clone myproject
</code></pre>
<h2 id="EXAMPLES">EXAMPLES</h2>
<h3 id="git-clone">git clone</h3>
<pre><code>$ git clone schacon/ticgit
&gt; git clone git://github.com/schacon/ticgit.git
$ git clone -p schacon/ticgit
&gt; git clone git@github.com:schacon/ticgit.git
$ git clone resque
&gt; git clone git@github.com/YOUR_USER/resque.git
</code></pre>
<h3 id="git-remote-add">git remote add</h3>
<pre><code>$ git remote add rtomayko
&gt; git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
$ git remote add -p rtomayko
&gt; git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
$ git remote add origin
&gt; git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
</code></pre>
<h3 id="git-fetch">git fetch</h3>
<pre><code>$ git fetch mislav
&gt; git remote add mislav git://github.com/mislav/REPO.git
&gt; git fetch mislav
$ git fetch mislav,xoebus
&gt; git remote add mislav ...
&gt; git remote add xoebus ...
&gt; git fetch --multiple mislav xoebus
</code></pre>
<h3 id="git-cherry-pick">git cherry-pick</h3>
<pre><code>$ git cherry-pick http://github.com/mislav/REPO/commit/SHA
&gt; git remote add -f mislav git://github.com/mislav/REPO.git
&gt; git cherry-pick SHA
$ git cherry-pick mislav@SHA
&gt; git remote add -f mislav git://github.com/mislav/CURRENT_REPO.git
&gt; git cherry-pick SHA
$ git cherry-pick mislav@SHA
&gt; git fetch mislav
&gt; git cherry-pick SHA
</code></pre>
<h3 id="git-am-git-apply">git am, git apply</h3>
<pre><code>$ git am https://github.com/defunkt/hub/pull/55
&gt; curl https://github.com/defunkt/hub/pull/55.patch -o /tmp/55.patch
&gt; git am /tmp/55.patch
$ git am --ignore-whitespace https://github.com/davidbalbert/hub/commit/fdb9921
&gt; curl https://github.com/davidbalbert/hub/commit/fdb9921.patch -o /tmp/fdb9921.patch
&gt; git am --ignore-whitespace /tmp/fdb9921.patch
$ git apply https://gist.github.com/8da7fb575debd88c54cf
&gt; curl https://gist.github.com/8da7fb575debd88c54cf.txt -o /tmp/gist-8da7fb575debd88c54cf.txt
&gt; git apply /tmp/gist-8da7fb575debd88c54cf.txt
</code></pre>
<h3 id="git-fork">git fork</h3>
<pre><code>$ git fork
[ repo forked on GitHub ]
&gt; git remote add -f YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
</code></pre>
<h3 id="git-pull-request">git pull-request</h3>
<pre><code># while on a topic branch called "feature":
$ git pull-request
[ opens text editor to edit title &amp; body for the request ]
[ opened pull request on GitHub for "YOUR_USER:feature" ]
# explicit title, pull base &amp; head:
$ git pull-request "I've implemented feature X" -b defunkt:master -h mislav:feature
$ git pull-request -i 123
[ attached pull request to issue #123 ]
</code></pre>
<h3 id="git-checkout">git checkout</h3>
<pre><code>$ git checkout https://github.com/defunkt/hub/pull/73
&gt; git remote add -f -t feature git://github:com/mislav/hub.git
&gt; git checkout --track -B mislav-feature mislav/feature
$ git checkout https://github.com/defunkt/hub/pull/73 custom-branch-name
</code></pre>
<h3 id="git-merge">git merge</h3>
<pre><code>$ git merge https://github.com/defunkt/hub/pull/73
&gt; git fetch git://github.com/mislav/hub.git +refs/heads/feature:refs/remotes/mislav/feature
&gt; git merge mislav/feature --no-ff -m 'Merge pull request #73 from mislav/feature...'
</code></pre>
<h3 id="git-create">git create</h3>
<pre><code>$ git create
[ repo created on GitHub ]
&gt; 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 ]
&gt; git remote add origin git@github.com:YOUR_USER/recipes.git
$ git create sinatra/recipes
[ repo created in GitHub organization ]
&gt; git remote add origin git@github.com:sinatra/recipes.git
</code></pre>
<h3 id="git-init">git init</h3>
<pre><code>$ git init -g
&gt; git init
&gt; git remote add origin git@github.com:YOUR_USER/REPO.git
</code></pre>
<h3 id="git-push">git push</h3>
<pre><code>$ git push origin,staging,qa bert_timeout
&gt; git push origin bert_timeout
&gt; git push staging bert_timeout
&gt; git push qa bert_timeout
</code></pre>
<h3 id="git-browse">git browse</h3>
<pre><code>$ git browse
&gt; open https://github.com/YOUR_USER/CURRENT_REPO
$ git browse -- commit/SHA
&gt; open https://github.com/YOUR_USER/CURRENT_REPO/commit/SHA
$ git browse -- issues
&gt; open https://github.com/YOUR_USER/CURRENT_REPO/issues
$ git browse schacon/ticgit
&gt; open https://github.com/schacon/ticgit
$ git browse schacon/ticgit commit/SHA
&gt; open https://github.com/schacon/ticgit/commit/SHA
$ git browse resque
&gt; open https://github.com/YOUR_USER/resque
$ git browse resque network
&gt; open https://github.com/YOUR_USER/resque/network
</code></pre>
<h3 id="git-compare">git compare</h3>
<pre><code>$ git compare refactor
&gt; open https://github.com/CURRENT_REPO/compare/refactor
$ git compare 1.0..1.1
&gt; open https://github.com/CURRENT_REPO/compare/1.0...1.1
$ git compare -u fix
&gt; (https://github.com/CURRENT_REPO/compare/fix)
$ git compare other-user patch
&gt; open https://github.com/other-user/REPO/compare/patch
</code></pre>
<h3 id="git-submodule">git submodule</h3>
<pre><code>$ hub submodule add wycats/bundler vendor/bundler
&gt; git submodule add git://github.com/wycats/bundler.git vendor/bundler
$ hub submodule add -p wycats/bundler vendor/bundler
&gt; git submodule add git@github.com:wycats/bundler.git vendor/bundler
$ hub submodule add -b ryppl ryppl/pip vendor/pip
&gt; git submodule add -b ryppl git://github.com/ryppl/pip.git vendor/pip
</code></pre>
<h3 id="git-help">git help</h3>
<pre><code>$ git help
&gt; (improved git help)
$ git help hub
&gt; (hub man page)
</code></pre>
<h2 id="BUGS">BUGS</h2>
<p><a href="https://github.com/defunkt/hub/issues" data-bare-link="true">https://github.com/defunkt/hub/issues</a></p>
<h2 id="AUTHORS">AUTHORS</h2>
<p><a href="https://github.com/defunkt/hub/contributors" data-bare-link="true">https://github.com/defunkt/hub/contributors</a></p>
<h2 id="SEE-ALSO">SEE ALSO</h2>
<p><span class="man-ref">git<span class="s">(1)</span></span>, <span class="man-ref">git-clone<span class="s">(1)</span></span>, <span class="man-ref">git-remote<span class="s">(1)</span></span>, <span class="man-ref">git-init<span class="s">(1)</span></span>,
<a href="http://github.com" data-bare-link="true">http://github.com</a>,
<a href="https://github.com/defunkt/hub" data-bare-link="true">https://github.com/defunkt/hub</a></p>
<ol class='man-decor man-foot man foot'>
<li class='tl'>DEFUNKT</li>
<li class='tc'>November 2012</li>
<li class='tr'>hub(1)</li>
</ol>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.