hub.1 11.2 KB
Newer Older
1 2
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
R
Ryan Tomayko 已提交
3
.
4
.TH "HUB" "1" "October 2011" "DEFUNKT" "Git Manual"
R
Ryan Tomayko 已提交
5 6
.
.SH "NAME"
C
Chris Wanstrath 已提交
7
\fBhub\fR \- git + hub = github
R
Ryan Tomayko 已提交
8 9
.
.SH "SYNOPSIS"
10 11 12 13
\fBhub\fR \fICOMMAND\fR \fIOPTIONS\fR
.
.br
\fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
C
0.3.1  
Chris Wanstrath 已提交
14
.
C
Chris Wanstrath 已提交
15
.P
16
\fBgit init \-g\fR \fIOPTIONS\fR
C
0.3.1  
Chris Wanstrath 已提交
17 18
.
.br
19
\fBgit create\fR [\fINAME\fR] [\fB\-p\fR] [\fB\-d\fR \fIDESCRIPTION\fR] [\fB\-h\fR \fIHOMEPAGE\fR]
20 21 22
.
.br
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
23
.
C
Chris Wanstrath 已提交
24
.br
25
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
C
0.3.1  
Chris Wanstrath 已提交
26 27
.
.br
C
Chris Wanstrath 已提交
28 29 30
\fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR]
.
.br
31
\fBgit fetch\fR \fIUSER\-1\fR,[\fIUSER\-2\fR,\.\.\.]
32 33
.
.br
34 35 36
\fBgit cherry\-pick\fR \fIGITHUB\-REF\fR
.
.br
37 38 39
\fBgit am\fR \fIGITHUB\-URL\fR
.
.br
40
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,\.\.\.,\fIREMOTE\-N\fR [\fIREF\fR]
C
0.3.1  
Chris Wanstrath 已提交
41 42
.
.br
43
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
C
0.3.1  
Chris Wanstrath 已提交
44 45
.
.br
46
\fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR
C
0.3.1  
Chris Wanstrath 已提交
47 48
.
.br
49
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
50
.
51 52 53
.br
\fBgit fork\fR [\fB\-\-no\-remote\fR]
.
R
Ryan Tomayko 已提交
54
.SH "DESCRIPTION"
55
\fBhub\fR enhances various \fBgit\fR commands with GitHub remote expansion\. The alias command displays information on configuring your environment:
R
Ryan Tomayko 已提交
56
.
C
Chris Wanstrath 已提交
57
.IP "\(bu" 4
58
\fBhub alias\fR [\fB\-s\fR] \fISHELL\fR: Writes shell aliasing code for \fISHELL\fR (\fBbash\fR, \fBsh\fR, \fBzsh\fR, \fBcsh\fR) to standard output\. With the \fB\-s\fR option, the output of this command can be evaluated directly within the shell:
59 60 61
.
.br
\fBeval $(hub alias \-s bash)\fR
R
Ryan Tomayko 已提交
62
.
C
Chris Wanstrath 已提交
63
.IP "\(bu" 4
64
\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\.
R
Ryan Tomayko 已提交
65
.
C
Chris Wanstrath 已提交
66
.IP "\(bu" 4
67
\fBgit create\fR [\fINAME\fR] [\fB\-p\fR] [\fB\-d\fR \fIDESCRIPTION\fR] [\fB\-h\fR \fIHOMEPAGE\fR]:
M
Mislav Marohnić 已提交
68 69
.
.br
70
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\.
C
Chris Wanstrath 已提交
71 72
.
.IP "\(bu" 4
M
Mislav Marohnić 已提交
73 74 75 76
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR:
.
.br
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\. With \fB\-p\fR, use private remote "git@github\.com:\fIUSER\fR/\fIREPOSITORY\fR\.git"\.
R
Ryan Tomayko 已提交
77
.
C
Chris Wanstrath 已提交
78
.IP "\(bu" 4
M
Mislav Marohnić 已提交
79 80 81 82
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR]:
.
.br
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\.
R
Ryan Tomayko 已提交
83
.
C
Chris Wanstrath 已提交
84 85 86 87
.IP "\(bu" 4
\fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR]
.
.br
88 89 90 91
Sets the url of remote \fIREMOTE\-NAME\fR using the same rules as \fBgit remote add\fR\.
.
.IP "\(bu" 4
\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\.
C
Chris Wanstrath 已提交
92 93
.
.IP "\(bu" 4
94
\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 <user>\fR is issued prior to the cherry\-pick attempt\.
95
.
C
Chris Wanstrath 已提交
96
.IP "\(bu" 4
97
\fBgit am\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\. Similar to \fBcherry\-pick\fR, but doesn\'t add new remotes\.
98
.
C
Chris Wanstrath 已提交
99
.IP "\(bu" 4
100
\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\.
101
.
C
Chris Wanstrath 已提交
102
.IP "\(bu" 4
103
\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")\.
C
Chris Wanstrath 已提交
104
.
C
Chris Wanstrath 已提交
105
.IP "\(bu" 4
106
\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")\.
C
Chris Wanstrath 已提交
107
.
C
Chris Wanstrath 已提交
108
.IP "\(bu" 4
M
Mislav Marohnić 已提交
109 110 111 112
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR:
.
.br
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"\.
S
Stephen Celis 已提交
113
.
C
Chris Wanstrath 已提交
114
.IP "\(bu" 4
115
\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\. Requires \fBgithub\.token\fR to be set (see CONFIGURATION)\.
116
.
C
Chris Wanstrath 已提交
117
.IP "\(bu" 4
118
\fBgit help\fR: Display enhanced git\-help(1)\.
R
Ryan Tomayko 已提交
119
.
C
Chris Wanstrath 已提交
120 121
.IP "" 0
.
R
Ryan Tomayko 已提交
122 123 124
.SH "CONFIGURATION"
Use git\-config(1) to display the currently configured GitHub username:
.
125 126
.IP "" 4
.
R
Ryan Tomayko 已提交
127
.nf
C
Chris Wanstrath 已提交
128

129
$ git config \-\-global github\.user
R
Ryan Tomayko 已提交
130 131 132
.
.fi
.
133 134
.IP "" 0
.
R
Ryan Tomayko 已提交
135
.P
136
Or, set the GitHub username and token with:
R
Ryan Tomayko 已提交
137
.
138 139
.IP "" 4
.
R
Ryan Tomayko 已提交
140
.nf
C
Chris Wanstrath 已提交
141

142 143
$ git config \-\-global github\.user <username>
$ git config \-\-global github\.token <token>
R
Ryan Tomayko 已提交
144 145 146
.
.fi
.
147 148
.IP "" 0
.
R
Ryan Tomayko 已提交
149
.P
150
See \fIhttp://github\.com/guides/local\-github\-config\fR for more information\.
C
Chris Wanstrath 已提交
151 152
.
.P
153
You can also tell \fBhub\fR to use \fBhttp://\fR rather than \fBgit://\fR when cloning:
C
Chris Wanstrath 已提交
154 155 156 157
.
.IP "" 4
.
.nf
C
Chris Wanstrath 已提交
158

159
$ git config \-\-global \-\-bool hub\.http\-clone true
C
Chris Wanstrath 已提交
160 161 162 163
.
.fi
.
.IP "" 0
R
Ryan Tomayko 已提交
164
.
165 166 167 168 169 170 171 172 173 174 175
.P
Want to use environment variables instead of a local gitconfig for authentication?
.
.IP "\(bu" 4
\fBGITHUB_USER\fR \- If set, this will be used instead of the \fBgithub\.user\fR config
.
.IP "\(bu" 4
\fBGITHUB_TOKEN\fR \- If set, this will be used instead of the \fBgithub\.token\fR
.
.IP "" 0
.
C
Chris Wanstrath 已提交
176 177 178 179 180
.SH "EXAMPLES"
.
.SS "git clone"
.
.nf
C
Chris Wanstrath 已提交
181

182
$ git clone schacon/ticgit
183
> git clone git://github\.com/schacon/ticgit\.git
184 185

$ git clone \-p schacon/ticgit
186
> git clone git@github\.com:schacon/ticgit\.git
C
Chris Wanstrath 已提交
187

C
Chris Wanstrath 已提交
188
$ git clone resque
189
> git clone git://github\.com/YOUR_USER/resque\.git
C
Chris Wanstrath 已提交
190

191
$ git clone \-p resque
192
> git clone git@github\.com:YOUR_USER/resque\.git
C
Chris Wanstrath 已提交
193 194 195 196 197 198
.
.fi
.
.SS "git remote add"
.
.nf
C
Chris Wanstrath 已提交
199

200
$ git remote add rtomayko
201
> git remote add rtomayko git://github\.com/rtomayko/CURRENT_REPO\.git
202 203

$ git remote add \-p rtomayko
204
> git remote add rtomayko git@github\.com:rtomayko/CURRENT_REPO\.git
C
Chris Wanstrath 已提交
205

C
Chris Wanstrath 已提交
206
$ git remote add origin
207
> git remote add origin git://github\.com/YOUR_USER/CURRENT_REPO\.git
C
Chris Wanstrath 已提交
208 209 210
.
.fi
.
211 212 213 214 215
.SS "git fetch"
.
.nf

$ git fetch mislav
216
> git remote add mislav git://github\.com/mislav/REPO\.git
217 218 219
> git fetch mislav

$ git fetch mislav,xoebus
220 221
> git remote add mislav \.\.\.
> git remote add xoebus \.\.\.
222 223 224 225
> git fetch \-\-multiple mislav xoebus
.
.fi
.
226 227 228 229
.SS "git cherry\-pick"
.
.nf

230 231
$ git cherry\-pick http://github\.com/mislav/REPO/commit/SHA
> git remote add \-f mislav git://github\.com/mislav/REPO\.git
232 233 234
> git cherry\-pick SHA

$ git cherry\-pick mislav@SHA
235
> git remote add \-f mislav git://github\.com/mislav/CURRENT_REPO\.git
236 237 238 239 240 241 242 243
> git cherry\-pick SHA

$ git cherry\-pick mislav@SHA
> git fetch mislav
> git cherry\-pick SHA
.
.fi
.
244 245 246 247 248 249 250 251 252 253 254 255 256 257
.SS "git am"
.
.nf

$ git am https://github\.com/defunkt/hub/pull/55
> curl https://github\.com/defunkt/hub/pull/55\.patch \-o /tmp/55\.patch
> git am /tmp/55\.patch

$ git am \-\-ignore\-whitespace https://github\.com/davidbalbert/hub/commit/fdb9921
> curl https://github\.com/davidbalbert/hub/commit/fdb9921\.patch \-o /tmp/fdb9921\.patch
> git am \-\-ignore\-whitespace /tmp/fdb9921\.patch
.
.fi
.
258 259 260
.SS "git fork"
.
.nf
C
Chris Wanstrath 已提交
261

262
$ git fork
263
[ repo forked on GitHub ]
264
> git remote add \-f YOUR_USER git@github\.com:YOUR_USER/CURRENT_REPO\.git
C
Chris Wanstrath 已提交
265 266 267
.
.fi
.
C
Chris Wanstrath 已提交
268 269 270 271 272
.SS "git create"
.
.nf

$ git create
273
[ repo created on GitHub ]
274
> git remote add origin git@github\.com:YOUR_USER/CURRENT_REPO\.git
275 276 277 278 279 280 281 282 283 284 285

# 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
C
Chris Wanstrath 已提交
286 287 288
.
.fi
.
289 290 291 292 293 294 295 296 297 298
.SS "git init"
.
.nf

$ git init \-g
> git init
> git remote add origin git@github\.com:YOUR_USER/REPO\.git
.
.fi
.
C
Chris Wanstrath 已提交
299 300 301
.SS "git push"
.
.nf
C
Chris Wanstrath 已提交
302

303
$ git push origin,staging,qa bert_timeout
C
Chris Wanstrath 已提交
304 305
> git push origin bert_timeout
> git push staging bert_timeout
306
> git push qa bert_timeout
C
Chris Wanstrath 已提交
307 308 309
.
.fi
.
C
Chris Wanstrath 已提交
310 311 312
.SS "git browse"
.
.nf
C
Chris Wanstrath 已提交
313

314
$ git browse
J
Justin Quick 已提交
315
> open https://github\.com/YOUR_USER/CURRENT_REPO
316

317 318 319
$ git browse \-\- commit/SHA
> open https://github\.com/YOUR_USER/CURRENT_REPO/commit/SHA

320
$ git browse \-\- issues
J
Justin Quick 已提交
321
> open https://github\.com/YOUR_USER/CURRENT_REPO/issues
322

323
$ git browse schacon/ticgit
324
> open https://github\.com/schacon/ticgit
C
Chris Wanstrath 已提交
325

326 327 328
$ git browse schacon/ticgit commit/SHA
> open https://github\.com/schacon/ticgit/commit/SHA

C
Chris Wanstrath 已提交
329
$ git browse resque
330
> open https://github\.com/YOUR_USER/resque
C
Chris Wanstrath 已提交
331

332
$ git browse resque network
333
> open https://github\.com/YOUR_USER/resque/network
334 335 336 337 338 339 340 341
.
.fi
.
.SS "git compare"
.
.nf

$ git compare refactor
342
> open https://github\.com/CURRENT_REPO/compare/refactor
343

344
$ git compare 1\.0\.\.1\.1
345
> open https://github\.com/CURRENT_REPO/compare/1\.0\.\.\.1\.1
346 347

$ git compare \-u fix
348
> (https://github\.com/CURRENT_REPO/compare/fix)
349

350
$ git compare other\-user patch
351
> open https://github\.com/other\-user/REPO/compare/patch
C
Chris Wanstrath 已提交
352 353 354
.
.fi
.
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
.SS "git submodule"
.
.nf

$ hub submodule add wycats/bundler vendor/bundler
> git submodule add git://github\.com/wycats/bundler\.git vendor/bundler

$ hub submodule add \-p wycats/bundler vendor/bundler
> git submodule add git@github\.com:wycats/bundler\.git vendor/bundler

$ hub submodule add \-b ryppl ryppl/pip vendor/pip
> git submodule add \-b ryppl git://github\.com/ryppl/pip\.git vendor/pip
.
.fi
.
C
Chris Wanstrath 已提交
370 371 372
.SS "git help"
.
.nf
C
Chris Wanstrath 已提交
373

374
$ git help
C
Chris Wanstrath 已提交
375 376
> (improved git help)
$ git help hub
377
> (hub man page)
C
Chris Wanstrath 已提交
378 379 380
.
.fi
.
R
Ryan Tomayko 已提交
381
.SH "BUGS"
382
\fIhttp://github\.com/defunkt/hub/issues\fR
R
Ryan Tomayko 已提交
383
.
384 385
.SH "AUTHORS"
\fIhttps://github\.com/defunkt/hub/contributors\fR
R
Ryan Tomayko 已提交
386 387
.
.SH "SEE ALSO"
388
git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github\.com\fR, \fIhttp://github\.com/defunkt/hub\fR