hub.1.html 13.7 KB
Newer Older
C
Chris Wanstrath 已提交
1 2 3 4
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv='content-type' value='text/html;charset=utf8'>
C
Chris Wanstrath 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
  <meta name='generator' value='Ronn/v0.5 (http://github.com/rtomayko/ronn)'>
  <title>hub(1) - git + hub = github</title>
  <style type='text/css' media='all'>
  /* STRUCTURE, INDENT, MARGINS */
  
  body                                { margin:0}
  #man                                { max-width:92ex; padding:0 2ex 1ex 2ex}
  
  #man p, #man pre,
  #man ul, #man ol, #man dl           { margin:0 0 20px 0}
  #man h2                             { margin:10px 0 0 0}
  
  #man > p, #man > pre,
  #man > ul, #man > ol, #man > dl     { margin-left:8ex}
  #man h3                             { margin:0 0 0 4ex}
  
  #man dt                             { margin:0; clear:left}
  #man dt.flush                       { float:left; width:8ex}
  #man dd                             { margin:0 0 0 9ex}
  #man h1, #man h2, #man h3, #man h4  { clear:left}
  
  #man pre                            { margin-bottom:20px}
  #man pre+h2, #man pre+h3            { margin-top:22px}
  #man h2+pre, #man h3+pre            { margin-top:5px}
  
  #man img                            { display:block;margin:auto}
  #man h1.man-title                   { display:none}
  
  /* FONTS */
  
  #man, #man code, #man pre,
  #man tt, #man kbd, #man samp,
  #man h3, #man h4 {
      font-family:monospace;
      font-size:14px;
      line-height:1.42857142857143;
  }
  #man h2, #man ol.man, #man .man-navigation a {
    font-size:16px;
    line-height:1.25
  }
  #man h1 {
    font-size:20px;
    line-height:2;
  }
  
  /* TEXT STYLES */
  
  #man {
    text-align:justify;
    background:#fff;
  }
  #man, #man code, #man pre, #man pre code,
  #man tt, #man kbd, #man samp            { color:#131211}
  #man h1, #man h2, #man h3, #man h4      { color:#030201}
  #man ol.man, #man ol.man li             { color:#636261}
  
  #man code, #man strong, #man b {
      font-weight:bold;
      color:#131211;
  }
  
  #man em, #man var, #man u {
      font-style:italic;
      color:#434241;
      text-decoration:none;
  }
  
  #man pre {
C
Chris Wanstrath 已提交
74
      background:#edeceb;
C
Chris Wanstrath 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
      padding:5px 1ex;
      border-left:1ex solid #ddd;
  }
  #man pre code {
      font-weight:normal;
      background:inherit;
  }
  
  /* DOCUMENT HEADER AND FOOTER AREAS */
  
  #man ol.man, #man ol.man li {
      margin:3px 0 10px 0;
      padding:0;
      float:left;
      width:33%;
      list-style-type:none;
      text-transform:uppercase;
      color:#999;
      letter-spacing:1px;
  }
  #man ol.man                  { width:100%}
  #man ol.man li.tl            { text-align:left}
  #man ol.man li.tc            { text-align:center; letter-spacing:4px}
  #man ol.man li.tr            { text-align:right; float:right}
  
  /* SECTION TOC NAVIGATION */
  
  #man div.man-navigation {
      position:fixed;
      top:0;
      left:106ex;
      height:100%;
      width:100%;
      padding:1ex 0 0 2ex;
      border-left:0.25ex solid #DCDCDC;
      background-color: #F5F5F5;
  }
  #man div.man-navigation a { display:block; margin-bottom:1.5ex}
  </style>
  <style type='text/css' media='print'>
  #man { max-width:none}
  #man div.man-navigation { display:none}
  #man a[href]:not([href^="#"]):not([data-bare-link]):after {
    content:" " attr(href);
  }
C
Chris Wanstrath 已提交
120 121
  </style>
</head>
C
Chris Wanstrath 已提交
122 123 124 125 126 127 128 129 130 131 132 133 134
<body id='manpage'>
  <div id='man'>

  <div class='man-navigation'>
    <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="#AUTHOR">AUTHOR</a>
    <a href="#SEE-ALSO">SEE ALSO</a>
    </div>
C
Chris Wanstrath 已提交
135

C
Chris Wanstrath 已提交
136
  <h1 class='man-title'>hub(1)</h1>
C
Chris Wanstrath 已提交
137

C
Chris Wanstrath 已提交
138 139 140 141 142
  <ol class='man head'>
    <li class='tl'>hub(1)</li>
    <li class='tc'>Git Manual</li>
    <li class='tr'>hub(1)</li>
  </ol>
C
Chris Wanstrath 已提交
143

C
Chris Wanstrath 已提交
144 145
  <h2 id='NAME'>NAME</h2>
<p><code>hub</code> - git + hub = github</p>
146

C
Chris Wanstrath 已提交
147
<h2 id="SYNOPSIS">SYNOPSIS</h2>
C
Chris Wanstrath 已提交
148

149
<p><code>hub</code> <var>COMMAND</var> <var>OPTIONS</var><br />
C
Chris Wanstrath 已提交
150
<code>hub alias</code> [<code>-s</code>] <var>SHELL</var></p>
C
Chris Wanstrath 已提交
151

152 153 154
<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 />
155
<code>git fetch</code> <var>USER-1</var>,[<var>USER-2</var>,...]<br />
156
<code>git cherry-pick</code> <var>GITHUB-REF</var><br />
157
<code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> <var>REF</var><br />
158 159 160 161
<code>git browse</code> [<code>-p</code>] [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]<br />
<code>git compare</code> [<code>-p</code>] [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var><br />
<code>git submodule add</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var><br />
<code>git fork</code> [<code>--no-remote</code>]</p>
C
Chris Wanstrath 已提交
162

C
Chris Wanstrath 已提交
163
<h2 id="DESCRIPTION">DESCRIPTION</h2>
C
Chris Wanstrath 已提交
164 165 166 167 168

<p><code>hub</code> enhances various <code>git</code> commands with GitHub remote expansion. The
alias command displays information on configuring your environment:</p>

<dl>
169
<dt><code>hub alias</code> [<code>-s</code>] <var>SHELL</var></dt><dd><p>Writes shell aliasing code for <var>SHELL</var> (<code>bash</code>, <code>sh</code>, <code>zsh</code>,
C
Chris Wanstrath 已提交
170
<code>csh</code>) to standard output. With the <code>-s</code> option, the output of
171
this command can be evaluated directly within the shell:<br />
172 173 174 175 176
<code>eval $(hub alias -s bash)</code></p></dd>
<dt><code>git init</code> <code>-g</code> <var>OPTIONS</var></dt><dd><p>Create a git repository as with git-init(1) 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
C
Chris Wanstrath 已提交
177 178
<var>DIRECTORY</var> as with git-clone(1). When <var>USER</var>/ is omitted, assumes
your GitHub login. With <code>-p</code>, use private remote
179 180
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git".</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
C
Chris Wanstrath 已提交
181 182
git-remote(1). When /<var>REPOSITORY</var> is omitted, the basename of the
current working directory is used. With <code>-p</code>, use private remote
C
Chris Wanstrath 已提交
183
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git". If <var>USER</var> is "origin"
184
then uses your GitHub login.</p></dd>
185 186
<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>
187 188 189 190
<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>
191 192
<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>
193
<dt><code>git browse</code> [<code>-p</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
C
Chris Wanstrath 已提交
194
using <code>open(1)</code> or the <code>BROWSER</code> env variable. Use <code>-p</code> to open a
195
page with https. If the repository isn't specified, <code>browse</code> opens
196 197 198 199
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>-p</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.
200
<var>START</var> to <var>END</var> are branch names, tag names, or commit SHA1s specifying
201 202
the range of history to compare. If <var>START</var> is omitted, GitHub will
compare against the base branch (the default is "master").</p></dd>
203
<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
S
Stephen Celis 已提交
204 205
<var>DIRECTORY</var> as with git-submodule(1). When <var>USER</var>/ is omitted, assumes
your GitHub login. With <code>-p</code>, use private remote
206
"git@github.com:<var>USER</var>/<var>REPOSITORY</var>.git".</p></dd>
207 208 209
<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. Requires <code>github.token</code> to
be set (see CONFIGURATION).</p></dd>
210
<dt><code>git help</code></dt><dd><p>Display enhanced git-help(1).</p></dd>
C
Chris Wanstrath 已提交
211 212 213
</dl>


C
Chris Wanstrath 已提交
214
<h2 id="CONFIGURATION">CONFIGURATION</h2>
C
Chris Wanstrath 已提交
215 216 217 218 219 220

<p>Use git-config(1) to display the currently configured GitHub username:</p>

<pre><code>$ git config --global github.user
</code></pre>

221
<p>Or, set the GitHub username and token with:</p>
C
Chris Wanstrath 已提交
222

223 224
<pre><code>$ git config --global github.user &lt;username>
$ git config --global github.token &lt;token>
C
Chris Wanstrath 已提交
225 226
</code></pre>

C
Chris Wanstrath 已提交
227
<p>See <a href="http://github.com/guides/local-github-config" data-bare-link="true">http://github.com/guides/local-github-config</a> for more
C
Chris Wanstrath 已提交
228 229 230 231 232
information.</p>

<p>You can also tell <code>hub</code> to use <code>http://</code> rather than <code>git://</code> when
cloning:</p>

233
<pre><code>$ git config --global --bool hub.http-clone true
C
Chris Wanstrath 已提交
234
</code></pre>
C
Chris Wanstrath 已提交
235

C
Chris Wanstrath 已提交
236
<h2 id="EXAMPLES">EXAMPLES</h2>
C
Chris Wanstrath 已提交
237

C
Chris Wanstrath 已提交
238
<h3 id="git-clone">git clone</h3>
C
Chris Wanstrath 已提交
239 240 241 242 243 244 245 246 247 248 249 250 251 252

<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

$ git clone -p resque
&gt; git clone git@github.com:YOUR_USER/resque.git
</code></pre>

C
Chris Wanstrath 已提交
253
<h3 id="git-remote-add">git remote add</h3>
C
Chris Wanstrath 已提交
254 255 256 257 258 259

<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
C
Chris Wanstrath 已提交
260 261

$ git remote add origin
C
Chris Wanstrath 已提交
262
&gt; git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
C
Chris Wanstrath 已提交
263
</code></pre>
264

C
Chris Wanstrath 已提交
265
<h3 id="git-fetch">git fetch</h3>
266 267 268 269 270 271 272 273 274 275

<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>
276

C
Chris Wanstrath 已提交
277
<h3 id="git-cherry-pick">git cherry-pick</h3>
278 279 280 281 282 283 284 285 286 287 288 289 290

<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>
C
Chris Wanstrath 已提交
291

C
Chris Wanstrath 已提交
292
<h3 id="git-fork">git fork</h3>
293 294 295 296 297 298

<pre><code>$ git fork
... hardcore forking action ...
&gt; git remote add YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
</code></pre>

C
Chris Wanstrath 已提交
299
<h3 id="git-init">git init</h3>
C
Chris Wanstrath 已提交
300 301 302 303 304 305

<pre><code>$ git init -g
&gt; git init
&gt; git remote add origin git@github.com:YOUR_USER/REPO.git
</code></pre>

C
Chris Wanstrath 已提交
306
<h3 id="git-push">git push</h3>
C
Chris Wanstrath 已提交
307 308 309 310 311 312 313

<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>

C
Chris Wanstrath 已提交
314
<h3 id="git-browse">git browse</h3>
C
Chris Wanstrath 已提交
315

316 317 318 319 320 321 322
<pre><code>$ git browse
&gt; open http://github.com/CURRENT_REPO

$ git browse -- issues
&gt; open http://github.com/CURRENT_REPO/issues

$ git browse schacon/ticgit
C
Chris Wanstrath 已提交
323 324 325
&gt; open http://github.com/schacon/ticgit

$ git browse -p schacon/ticgit
326
&gt; open https://github.com/schacon/ticgit
C
Chris Wanstrath 已提交
327 328 329 330

$ git browse resque
&gt; open http://github.com/YOUR_USER/resque

331 332 333
$ git browse resque network
&gt; open http://github.com/YOUR_USER/resque/network

C
Chris Wanstrath 已提交
334
$ git browse -p resque
335
&gt; open https://github.com/YOUR_USER/resque
C
Chris Wanstrath 已提交
336 337
</code></pre>

C
Chris Wanstrath 已提交
338
<h3 id="git-compare">git compare</h3>
339 340 341 342 343 344 345 346 347 348

<pre><code>$ git compare refactor
&gt; open http://github.com/CURRENT_REPO/compare/refactor

$ git compare 1.0...1.1
&gt; open http://github.com/CURRENT_REPO/compare/1.0...1.1

$ git compare -u fix
&gt; (http://github.com/CURRENT_REPO/compare/fix)

349 350
$ git compare other-user patch
&gt; open http://github.com/other-user/REPO/compare/patch
351 352
</code></pre>

C
Chris Wanstrath 已提交
353
<h3 id="git-help">git help</h3>
C
Chris Wanstrath 已提交
354 355 356 357 358 359 360

<pre><code>$ git help
&gt; (improved git help)
$ git help hub
&gt; (hub man page)
</code></pre>

C
Chris Wanstrath 已提交
361
<h2 id="BUGS">BUGS</h2>
C
Chris Wanstrath 已提交
362

C
Chris Wanstrath 已提交
363
<p><a href="http://github.com/defunkt/hub/issues" data-bare-link="true">http://github.com/defunkt/hub/issues</a></p>
C
Chris Wanstrath 已提交
364

C
Chris Wanstrath 已提交
365
<h2 id="AUTHOR">AUTHOR</h2>
C
Chris Wanstrath 已提交
366 367 368

<p>Chris Wanstrath :: chris@ozmm.org :: @defunkt</p>

C
Chris Wanstrath 已提交
369
<h2 id="SEE-ALSO">SEE ALSO</h2>
C
Chris Wanstrath 已提交
370 371

<p>git(1), git-clone(1), git-remote(1), git-init(1),
C
Chris Wanstrath 已提交
372 373
<a href="http://github.com" data-bare-link="true">http://github.com</a>,
<a href="http://github.com/defunkt/hub" data-bare-link="true">http://github.com/defunkt/hub</a></p>
C
Chris Wanstrath 已提交
374

375

C
Chris Wanstrath 已提交
376 377 378 379 380
  <ol class='man foot'>
    <li class='tl'>DEFUNKT</li>
    <li class='tc'>June 2010</li>
    <li class='tr'>hub(1)</li>
  </ol>
C
Chris Wanstrath 已提交
381

C
Chris Wanstrath 已提交
382
  </div>
C
Chris Wanstrath 已提交
383 384
</body>
</html>