hub.1 6.5 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
\fBhub\fR \fICOMMAND\fR \fIOPTIONS\fR \fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
C
0.3.1  
Chris Wanstrath 已提交
11
.
C
Chris Wanstrath 已提交
12
.P
13
\fBgit init \-g\fR \fIOPTIONS\fR
C
0.3.1  
Chris Wanstrath 已提交
14 15
.
.br
16
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
17
.
C
Chris Wanstrath 已提交
18
.br
19
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
C
0.3.1  
Chris Wanstrath 已提交
20 21
.
.br
C
Chris Wanstrath 已提交
22
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
C
0.3.1  
Chris Wanstrath 已提交
23 24
.
.br
C
Chris Wanstrath 已提交
25
\fBgit fork\fR
C
0.3.1  
Chris Wanstrath 已提交
26 27
.
.br
28
\fBgit browse\fR [\fB\-p\fR] [\fIUSER\fR/]\fIREPOSITORY\fR
C
0.3.1  
Chris Wanstrath 已提交
29 30
.
.br
31
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
R
Ryan Tomayko 已提交
32 33 34 35 36 37
.
.SH "DESCRIPTION"
\fBhub\fR enhances various \fBgit\fR commands with GitHub remote expansion. The
alias command displays information on configuring your environment:
.
.TP
38 39 40
\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: \fBeval $(hub alias \-s bash)\fR
R
Ryan Tomayko 已提交
41 42
.
.TP
43 44 45
\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 已提交
46 47
.
.TP
48
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR
C
Chris Wanstrath 已提交
49
Clone repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-clone(1). When \fIUSER\fR/ is omitted, assumes
50
your GitHub login. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
51
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
R
Ryan Tomayko 已提交
52 53
.
.TP
54
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR]
55 56
Add remote "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" as with
git\-remote(1). When /\fIREPOSITORY\fR is omitted, the basename of the
57
current working directory is used. With \fB\-p\fR, use private remote
C
Chris Wanstrath 已提交
58 59
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git". If \fIUSER\fR is "origin"
then uses your GitHub login.
R
Ryan Tomayko 已提交
60 61
.
.TP
62
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,...,\fIREMOTE\-N\fR \fIREF\fR
63 64 65 66
Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing
multiple \fBgit push\fR commands.
.
.TP
67
\fBgit fork\fR
C
Chris Wanstrath 已提交
68 69 70 71 72
Forks the original repo on GitHub and adds the new remote under your
username. It requires your GitHub login and token to be present. See
CONFIGURATION below.
.
.TP
73
\fBgit browse\fR [\fB\-p\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR]
C
Chris Wanstrath 已提交
74
Open repository's GitHub page in the system's default web browser
75
using \fBopen(1)\fR or the \fBBROWSER\fR env variable. Use \fB\-p\fR to open a
76 77
page with https. If the repository isn't specified, \fBbrowse\fR opens
the page of the repository found in the current directory.
C
Chris Wanstrath 已提交
78 79
.
.TP
80 81 82 83
\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 \fISTART\fR is omitted,
the repository's default branch is assumed.
C
Chris Wanstrath 已提交
84
.
85 86
.TP
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
S
Stephen Celis 已提交
87
Submodule repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-submodule(1). When \fIUSER\fR/ is omitted, assumes
88
your GitHub login. With \fB\-p\fR, use private remote
S
Stephen Celis 已提交
89 90 91
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
.
.TP
92
\fBgit fork\fR [\fB\-\-no\-remote\fR]
93 94 95 96 97
Forks the original project (as specified in "origin" remote) on GitHub
and adds a new remote named \fIUSER\fR referencing the newly created repo.
Requires \fBgithub.token\fR to be set (see CONFIGURATION).
.
.TP
98
\fBgit help\fR
R
Ryan Tomayko 已提交
99 100 101 102 103
Display enhanced git\-help(1).
.
.SH "CONFIGURATION"
Use git\-config(1) to display the currently configured GitHub username:
.
104 105
.IP "" 4
.
R
Ryan Tomayko 已提交
106
.nf
C
Chris Wanstrath 已提交
107

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

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

140
$ git config \-\-global \-\-add hub.http\-clone yes
C
Chris Wanstrath 已提交
141 142 143 144
.
.fi
.
.IP "" 0
R
Ryan Tomayko 已提交
145
.
C
Chris Wanstrath 已提交
146 147 148 149 150
.SH "EXAMPLES"
.
.SS "git clone"
.
.nf
C
Chris Wanstrath 已提交
151

152 153 154 155
$ git clone schacon/ticgit
> git clone git://github.com/schacon/ticgit.git

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

C
Chris Wanstrath 已提交
158 159
$ git clone resque
> git clone git://github.com/YOUR_USER/resque.git
C
Chris Wanstrath 已提交
160

161
$ git clone \-p resque
C
Chris Wanstrath 已提交
162 163 164 165 166 167 168
> git clone git@github.com:YOUR_USER/resque.git
.
.fi
.
.SS "git remote add"
.
.nf
C
Chris Wanstrath 已提交
169

170 171 172 173
$ git remote add rtomayko
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git

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

C
Chris Wanstrath 已提交
176
$ git remote add origin
C
Chris Wanstrath 已提交
177
> git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
C
Chris Wanstrath 已提交
178 179 180
.
.fi
.
181 182 183
.SS "git fork"
.
.nf
C
Chris Wanstrath 已提交
184

185
$ git fork
186
... hardcore forking action ...
187
> git remote add YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
188 189 190
.
.fi
.
C
Chris Wanstrath 已提交
191 192 193
.SS "git init"
.
.nf
C
Chris Wanstrath 已提交
194

195
$ git init \-g
C
Chris Wanstrath 已提交
196
> git init
197
> git remote add origin git@github.com:YOUR_USER/REPO.git
C
Chris Wanstrath 已提交
198 199 200 201 202 203
.
.fi
.
.SS "git push"
.
.nf
C
Chris Wanstrath 已提交
204

205
$ git push origin,staging,qa bert_timeout
C
Chris Wanstrath 已提交
206 207
> git push origin bert_timeout
> git push staging bert_timeout
208
> git push qa bert_timeout
C
Chris Wanstrath 已提交
209 210 211
.
.fi
.
C
Chris Wanstrath 已提交
212 213 214
.SS "git browse"
.
.nf
C
Chris Wanstrath 已提交
215

216 217 218 219
$ git browse schacon/ticgit
> open http://github.com/schacon/ticgit

$ git browse \-p schacon/ticgit
C
Chris Wanstrath 已提交
220
> open http://github.com/schacon/ticgit
C
Chris Wanstrath 已提交
221

C
Chris Wanstrath 已提交
222 223
$ git browse resque
> open http://github.com/YOUR_USER/resque
C
Chris Wanstrath 已提交
224

225
$ git browse \-p resque
C
Chris Wanstrath 已提交
226
> open https://github.com:YOUR_USER/resque
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
.
.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)

$ git compare myfork patch
> open http://github.com/myfork/compare/patch
C
Chris Wanstrath 已提交
245 246 247
.
.fi
.
C
Chris Wanstrath 已提交
248 249 250
.SS "git help"
.
.nf
C
Chris Wanstrath 已提交
251

252
$ git help
C
Chris Wanstrath 已提交
253 254
> (improved git help)
$ git help hub
255
> (hub man page)
C
Chris Wanstrath 已提交
256 257 258
.
.fi
.
R
Ryan Tomayko 已提交
259 260 261 262 263 264 265
.SH "BUGS"
\fIhttp://github.com/defunkt/hub/issues\fR
.
.SH "AUTHOR"
Chris Wanstrath :: chris@ozmm.org :: @defunkt
.
.SH "SEE ALSO"
266
git(1), git\-clone(1), git\-remote(1), git\-init(1), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/hub\fR