hub.1 9.1 KB
Newer Older
1 2
.\" generated with Ronn/v0.5
.\" http://github.com/rtomayko/ronn/
R
Ryan Tomayko 已提交
3
.
C
Chris Wanstrath 已提交
4
.TH "HUB" "1" "August 2010" "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
C
Chris Wanstrath 已提交
19
\fBgit create\fR [\fB\-p\fR] [\fB\-d <DESCRIPTION>\fR] [\fB\-h <HOMEPAGE>\fR]: \fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
20
.
C
Chris Wanstrath 已提交
21
.br
22
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
C
0.3.1  
Chris Wanstrath 已提交
23 24
.
.br
C
Chris Wanstrath 已提交
25 26 27
\fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR]
.
.br
28 29 30
\fBgit fetch\fR \fIUSER\-1\fR,[\fIUSER\-2\fR,...]
.
.br
31 32 33
\fBgit cherry\-pick\fR \fIGITHUB\-REF\fR
.
.br
C
Chris Wanstrath 已提交
34
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
C
0.3.1  
Chris Wanstrath 已提交
35 36
.
.br
37
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
C
0.3.1  
Chris Wanstrath 已提交
38 39
.
.br
40
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR...]\fIEND\fR
C
0.3.1  
Chris Wanstrath 已提交
41 42
.
.br
43
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
44
.
45 46 47
.br
\fBgit fork\fR [\fB\-\-no\-remote\fR]
.
R
Ryan Tomayko 已提交
48 49 50 51
.SH "DESCRIPTION"
\fBhub\fR enhances various \fBgit\fR commands with GitHub remote expansion. The
alias command displays information on configuring your environment:
.
C
Chris Wanstrath 已提交
52 53
.IP "\(bu" 4
\fBhub alias\fR [\fB\-s\fR] \fISHELL\fR:
54
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
55 56 57 58
this command can be evaluated directly within the shell:
.
.br
\fBeval $(hub alias \-s bash)\fR
R
Ryan Tomayko 已提交
59
.
C
Chris Wanstrath 已提交
60 61
.IP "\(bu" 4
\fBgit init\fR \fB\-g\fR \fIOPTIONS\fR:
62 63
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 已提交
64
.
C
Chris Wanstrath 已提交
65 66 67 68 69 70 71 72 73 74 75
.IP "\(bu" 4
\fBgit create\fR [\fB\-p\fR] [\fB\-d <DESCRIPTION>\fR] [\fB\-h <HOMEPAGE>\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's
basename. With \fB\-p\fR, create a private repository. \fB\-d\fR and \fB\-h\fR
set the repository's description and homepage, respectively.
.
.IP "\(bu" 4
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR:
C
Chris Wanstrath 已提交
76
Clone repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-clone(1). When \fIUSER\fR/ is omitted, assumes
77
your GitHub login. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
78
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
R
Ryan Tomayko 已提交
79
.
C
Chris Wanstrath 已提交
80 81
.IP "\(bu" 4
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR]:
82 83
Add remote "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" as with
git\-remote(1). When /\fIREPOSITORY\fR is omitted, the basename of the
84
current working directory is used. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
85 86
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git". If \fIUSER\fR is "origin"
then uses your GitHub login.
R
Ryan Tomayko 已提交
87
.
C
Chris Wanstrath 已提交
88 89 90 91 92 93 94 95
.IP "\(bu" 4
\fBgit remote set\-url\fR [\fB\-p\fR] \fIOPTIONS\fR \fIREMOTE\-NAME\fR \fIUSER\fR[/\fIREPOSITORY\fR]
.
.br
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,...]:
96 97 98
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 已提交
99 100
.IP "\(bu" 4
\fBgit cherry\-pick\fR \fIGITHUB\-REF\fR:
101 102 103 104 105
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.
.
C
Chris Wanstrath 已提交
106 107
.IP "\(bu" 4
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR:
108 109 110
Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing
multiple \fBgit push\fR commands.
.
C
Chris Wanstrath 已提交
111 112
.IP "\(bu" 4
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]:
C
Chris Wanstrath 已提交
113
Open repository's GitHub page in the system's default web browser
114
using \fBopen(1)\fR or the \fBBROWSER\fR env variable. Use \fB\-p\fR to open a
115
page with https. If the repository isn't specified, \fBbrowse\fR opens
116 117 118
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 已提交
119
.
C
Chris Wanstrath 已提交
120 121
.IP "\(bu" 4
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR...]\fIEND\fR:
122
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
123 124
the range of history to compare. If \fISTART\fR is omitted, GitHub will
compare against the base branch (the default is "master").
C
Chris Wanstrath 已提交
125
.
C
Chris Wanstrath 已提交
126 127
.IP "\(bu" 4
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR:
S
Stephen Celis 已提交
128
Submodule repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-submodule(1). When \fIUSER\fR/ is omitted, assumes
129
your GitHub login. With \fB\-p\fR, use private remote
S
Stephen Celis 已提交
130 131
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
.
C
Chris Wanstrath 已提交
132 133
.IP "\(bu" 4
\fBgit fork\fR [\fB\-\-no\-remote\fR]:
134 135 136
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).
137
.
C
Chris Wanstrath 已提交
138 139
.IP "\(bu" 4
\fBgit help\fR:
R
Ryan Tomayko 已提交
140 141
Display enhanced git\-help(1).
.
C
Chris Wanstrath 已提交
142 143
.IP "" 0
.
R
Ryan Tomayko 已提交
144 145 146
.SH "CONFIGURATION"
Use git\-config(1) to display the currently configured GitHub username:
.
147 148
.IP "" 4
.
R
Ryan Tomayko 已提交
149
.nf
C
Chris Wanstrath 已提交
150

151
$ git config \-\-global github.user
R
Ryan Tomayko 已提交
152 153 154
.
.fi
.
155 156
.IP "" 0
.
R
Ryan Tomayko 已提交
157
.P
158
Or, set the GitHub username and token with:
R
Ryan Tomayko 已提交
159
.
160 161
.IP "" 4
.
R
Ryan Tomayko 已提交
162
.nf
C
Chris Wanstrath 已提交
163

164 165
$ git config \-\-global github.user <username>
$ git config \-\-global github.token <token>
R
Ryan Tomayko 已提交
166 167 168
.
.fi
.
169 170
.IP "" 0
.
R
Ryan Tomayko 已提交
171
.P
C
Chris Wanstrath 已提交
172 173 174 175 176 177 178 179 180 181
See \fIhttp://github.com/guides/local\-github\-config\fR for more
information.
.
.P
You can also tell \fBhub\fR to use \fBhttp://\fR rather than \fBgit://\fR when
cloning:
.
.IP "" 4
.
.nf
C
Chris Wanstrath 已提交
182

183
$ git config \-\-global \-\-bool hub.http\-clone true
C
Chris Wanstrath 已提交
184 185 186 187
.
.fi
.
.IP "" 0
R
Ryan Tomayko 已提交
188
.
C
Chris Wanstrath 已提交
189 190 191 192 193
.SH "EXAMPLES"
.
.SS "git clone"
.
.nf
C
Chris Wanstrath 已提交
194

195 196 197 198
$ git clone schacon/ticgit
> git clone git://github.com/schacon/ticgit.git

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

C
Chris Wanstrath 已提交
201 202
$ git clone resque
> git clone git://github.com/YOUR_USER/resque.git
C
Chris Wanstrath 已提交
203

204
$ git clone \-p resque
C
Chris Wanstrath 已提交
205 206 207 208 209 210 211
> git clone git@github.com:YOUR_USER/resque.git
.
.fi
.
.SS "git remote add"
.
.nf
C
Chris Wanstrath 已提交
212

213 214 215 216
$ git remote add rtomayko
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git

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

C
Chris Wanstrath 已提交
219
$ git remote add origin
C
Chris Wanstrath 已提交
220
> git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
C
Chris Wanstrath 已提交
221 222 223
.
.fi
.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
.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
.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
.SS "git cherry\-pick"
.
.nf

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

$ git cherry\-pick mislav@SHA
> git remote add \-f 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
.
257 258 259
.SS "git fork"
.
.nf
C
Chris Wanstrath 已提交
260

261
$ git fork
262
... hardcore forking action ...
263
> git remote add YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
264 265 266
.
.fi
.
C
Chris Wanstrath 已提交
267 268 269
.SS "git init"
.
.nf
C
Chris Wanstrath 已提交
270

271
$ git init \-g
C
Chris Wanstrath 已提交
272
> git init
273
> git remote add origin git@github.com:YOUR_USER/REPO.git
C
Chris Wanstrath 已提交
274 275 276
.
.fi
.
C
Chris Wanstrath 已提交
277 278 279 280 281 282 283 284 285 286
.SS "git create"
.
.nf

$ git create
... hardcore creating action ...
> git remote add origin git@github.com:YOUR_USER/CURRENT_REPO.git
.
.fi
.
C
Chris Wanstrath 已提交
287 288 289
.SS "git push"
.
.nf
C
Chris Wanstrath 已提交
290

291
$ git push origin,staging,qa bert_timeout
C
Chris Wanstrath 已提交
292 293
> git push origin bert_timeout
> git push staging bert_timeout
294
> git push qa bert_timeout
C
Chris Wanstrath 已提交
295 296 297
.
.fi
.
C
Chris Wanstrath 已提交
298 299 300
.SS "git browse"
.
.nf
C
Chris Wanstrath 已提交
301

302 303 304 305 306 307
$ git browse
> open http://github.com/CURRENT_REPO

$ git browse \-\- issues
> open http://github.com/CURRENT_REPO/issues

308 309 310 311
$ git browse schacon/ticgit
> open http://github.com/schacon/ticgit

$ git browse \-p schacon/ticgit
312
> open https://github.com/schacon/ticgit
C
Chris Wanstrath 已提交
313

C
Chris Wanstrath 已提交
314 315
$ git browse resque
> open http://github.com/YOUR_USER/resque
C
Chris Wanstrath 已提交
316

317 318 319
$ git browse resque network
> open http://github.com/YOUR_USER/resque/network

320
$ git browse \-p resque
321
> open https://github.com/YOUR_USER/resque
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
.
.fi
.
.SS "git compare"
.
.nf

$ git compare refactor
> open http://github.com/CURRENT_REPO/compare/refactor

$ git compare 1.0...1.1
> open http://github.com/CURRENT_REPO/compare/1.0...1.1

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

338 339
$ git compare other\-user patch
> open http://github.com/other\-user/REPO/compare/patch
C
Chris Wanstrath 已提交
340 341 342
.
.fi
.
C
Chris Wanstrath 已提交
343 344 345
.SS "git help"
.
.nf
C
Chris Wanstrath 已提交
346

347
$ git help
C
Chris Wanstrath 已提交
348 349
> (improved git help)
$ git help hub
350
> (hub man page)
C
Chris Wanstrath 已提交
351 352 353
.
.fi
.
R
Ryan Tomayko 已提交
354 355 356 357 358 359 360
.SH "BUGS"
\fIhttp://github.com/defunkt/hub/issues\fR
.
.SH "AUTHOR"
Chris Wanstrath :: chris@ozmm.org :: @defunkt
.
.SH "SEE ALSO"
361
git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/hub\fR