hub.1 6.8 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" "April 2010" "DEFUNKT" "Git Manual"
R
Ryan Tomayko 已提交
5 6 7 8 9
.
.SH "NAME"
\fBhub\fR \-\- git + hub = github
.
.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 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
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
C
0.3.1  
Chris Wanstrath 已提交
26 27
.
.br
28
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
C
0.3.1  
Chris Wanstrath 已提交
29 30
.
.br
31
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR...]\fIEND\fR
C
0.3.1  
Chris Wanstrath 已提交
32 33
.
.br
34
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
35
.
36 37 38
.br
\fBgit fork\fR [\fB\-\-no\-remote\fR]
.
R
Ryan Tomayko 已提交
39 40 41 42 43
.SH "DESCRIPTION"
\fBhub\fR enhances various \fBgit\fR commands with GitHub remote expansion. The
alias command displays information on configuring your environment:
.
.TP
44 45
\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
46 47 48 49
this command can be evaluated directly within the shell:
.
.br
\fBeval $(hub alias \-s bash)\fR
R
Ryan Tomayko 已提交
50 51
.
.TP
52 53 54
\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 已提交
55 56
.
.TP
57
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR
C
Chris Wanstrath 已提交
58
Clone repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-clone(1). When \fIUSER\fR/ is omitted, assumes
59
your GitHub login. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
60
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
R
Ryan Tomayko 已提交
61 62
.
.TP
63
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR]
64 65
Add remote "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" as with
git\-remote(1). When /\fIREPOSITORY\fR is omitted, the basename of the
66
current working directory is used. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
67 68
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git". If \fIUSER\fR is "origin"
then uses your GitHub login.
R
Ryan Tomayko 已提交
69 70
.
.TP
71
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
72 73 74 75
Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing
multiple \fBgit push\fR commands.
.
.TP
76
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
C
Chris Wanstrath 已提交
77
Open repository's GitHub page in the system's default web browser
78
using \fBopen(1)\fR or the \fBBROWSER\fR env variable. Use \fB\-p\fR to open a
79
page with https. If the repository isn't specified, \fBbrowse\fR opens
80 81 82
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 已提交
83 84
.
.TP
85
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR...]\fIEND\fR
86
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
87 88
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 已提交
89
.
90 91
.TP
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
S
Stephen Celis 已提交
92
Submodule repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-submodule(1). When \fIUSER\fR/ is omitted, assumes
93
your GitHub login. With \fB\-p\fR, use private remote
S
Stephen Celis 已提交
94 95 96
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
.
.TP
97
\fBgit fork\fR [\fB\-\-no\-remote\fR]
98 99 100
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).
101 102
.
.TP
103
\fBgit help\fR
R
Ryan Tomayko 已提交
104 105 106 107 108
Display enhanced git\-help(1).
.
.SH "CONFIGURATION"
Use git\-config(1) to display the currently configured GitHub username:
.
109 110
.IP "" 4
.
R
Ryan Tomayko 已提交
111
.nf
C
Chris Wanstrath 已提交
112

113
$ git config \-\-global github.user
R
Ryan Tomayko 已提交
114 115 116
.
.fi
.
117 118
.IP "" 0
.
R
Ryan Tomayko 已提交
119
.P
120
Or, set the GitHub username and token with:
R
Ryan Tomayko 已提交
121
.
122 123
.IP "" 4
.
R
Ryan Tomayko 已提交
124
.nf
C
Chris Wanstrath 已提交
125

126 127
$ git config \-\-global github.user <username>
$ git config \-\-global github.token <token>
R
Ryan Tomayko 已提交
128 129 130
.
.fi
.
131 132
.IP "" 0
.
R
Ryan Tomayko 已提交
133
.P
C
Chris Wanstrath 已提交
134 135 136 137 138 139 140 141 142 143
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 已提交
144

145
$ git config \-\-global \-\-bool hub.http\-clone true
C
Chris Wanstrath 已提交
146 147 148 149
.
.fi
.
.IP "" 0
R
Ryan Tomayko 已提交
150
.
C
Chris Wanstrath 已提交
151 152 153 154 155
.SH "EXAMPLES"
.
.SS "git clone"
.
.nf
C
Chris Wanstrath 已提交
156

157 158 159 160
$ git clone schacon/ticgit
> git clone git://github.com/schacon/ticgit.git

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

C
Chris Wanstrath 已提交
163 164
$ git clone resque
> git clone git://github.com/YOUR_USER/resque.git
C
Chris Wanstrath 已提交
165

166
$ git clone \-p resque
C
Chris Wanstrath 已提交
167 168 169 170 171 172 173
> git clone git@github.com:YOUR_USER/resque.git
.
.fi
.
.SS "git remote add"
.
.nf
C
Chris Wanstrath 已提交
174

175 176 177 178
$ git remote add rtomayko
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git

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

C
Chris Wanstrath 已提交
181
$ git remote add origin
C
Chris Wanstrath 已提交
182
> git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
C
Chris Wanstrath 已提交
183 184 185
.
.fi
.
186 187 188
.SS "git fork"
.
.nf
C
Chris Wanstrath 已提交
189

190
$ git fork
191
... hardcore forking action ...
192
> git remote add YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
193 194 195
.
.fi
.
C
Chris Wanstrath 已提交
196 197 198
.SS "git init"
.
.nf
C
Chris Wanstrath 已提交
199

200
$ git init \-g
C
Chris Wanstrath 已提交
201
> git init
202
> git remote add origin git@github.com:YOUR_USER/REPO.git
C
Chris Wanstrath 已提交
203 204 205 206 207 208
.
.fi
.
.SS "git push"
.
.nf
C
Chris Wanstrath 已提交
209

210
$ git push origin,staging,qa bert_timeout
C
Chris Wanstrath 已提交
211 212
> git push origin bert_timeout
> git push staging bert_timeout
213
> git push qa bert_timeout
C
Chris Wanstrath 已提交
214 215 216
.
.fi
.
C
Chris Wanstrath 已提交
217 218 219
.SS "git browse"
.
.nf
C
Chris Wanstrath 已提交
220

221 222 223 224 225 226
$ git browse
> open http://github.com/CURRENT_REPO

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

227 228 229 230
$ git browse schacon/ticgit
> open http://github.com/schacon/ticgit

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

C
Chris Wanstrath 已提交
233 234
$ git browse resque
> open http://github.com/YOUR_USER/resque
C
Chris Wanstrath 已提交
235

236 237 238
$ git browse resque network
> open http://github.com/YOUR_USER/resque/network

239
$ git browse \-p resque
240
> open https://github.com/YOUR_USER/resque
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
.
.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)

257 258
$ git compare other\-user patch
> open http://github.com/other\-user/REPO/compare/patch
C
Chris Wanstrath 已提交
259 260 261
.
.fi
.
C
Chris Wanstrath 已提交
262 263 264
.SS "git help"
.
.nf
C
Chris Wanstrath 已提交
265

266
$ git help
C
Chris Wanstrath 已提交
267 268
> (improved git help)
$ git help hub
269
> (hub man page)
C
Chris Wanstrath 已提交
270 271 272
.
.fi
.
R
Ryan Tomayko 已提交
273 274 275 276 277 278 279
.SH "BUGS"
\fIhttp://github.com/defunkt/hub/issues\fR
.
.SH "AUTHOR"
Chris Wanstrath :: chris@ozmm.org :: @defunkt
.
.SH "SEE ALSO"
280
git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/hub\fR