-
Notifications
You must be signed in to change notification settings - Fork 7
/
git-brws.1
438 lines (416 loc) · 10.1 KB
/
git-brws.1
1
2
3
4
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
74
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-BRWS" "1" "September 2020" "" ""
.
.SH "NAME"
\fBgit\-brws\fR \- open a repository, file, commit, diff, pull request or issue in your web browser
.
.SH "SYNOPSIS"
\fBgit brws\fR
.
.br
\fBgit brws\fR \fIfile\fR\.\.\.
.
.br
\fBgit brws\fR \fIfile\fR#\fIlnum\fR\.\.\.
.
.br
\fBgit brws\fR \fIbranch\fR
.
.br
\fBgit brws\fR \fIcommit\fR
.
.br
\fBgit brws\fR \fItag\fR
.
.br
\fBgit brws\fR \fIcommit\fR\.\.\fIcommit\fR
.
.br
\fBgit brws\fR \fIcommit\fR\.\.\.\fIcommit\fR
.
.br
\fBgit brws\fR \-\-repo \fIrepo\fR
.
.br
\fBgit brws\fR \-\-pr
.
.br
\fBgit brws\fR \-\-website
.
.br
.
.SH "DESCRIPTION"
\fBgit\-brws\fR is a command line tool to open a repository, file, commit, diff, tag, blame, pull request, issue or project\'s website in your web browser from command line\. \'brws\' is an abbreviation of \'browse\'\.
.
.P
Example of pages which \fBgit\-brws\fR can open are:
.
.IP "\(bu" 4
\fBRepository\fR: https://github\.com/rhysd/git\-brws
.
.IP "\(bu" 4
\fBFile\fR: https://github\.com/rhysd/git\-brws/blob/38f46f1/Cargo\.toml
.
.IP "\(bu" 4
\fBPart of file\fR: https://github\.com/rhysd/git\-brws/blob/38f46f1/Cargo\.toml#L2\-L10
.
.IP "\(bu" 4
\fBCommit\fR: https://github\.com/rhysd/git\-brws/commit/60024ab
.
.IP "\(bu" 4
\fBDiff\fR: https://github\.com/rhysd/git\-brws/compare/e3c18d0\.\.60024ab
.
.IP "\(bu" 4
\fBTag\fR https://github\.com/rhysd/git\-brws/tree/0\.10\.0
.
.IP "\(bu" 4
\fBPull request\fR: https://github\.com/rust\-lang/rust\.vim/pull/290
.
.IP "\(bu" 4
\fBIssue\fR: https://github\.com/rhysd/git\-brws/issues/8
.
.IP "\(bu" 4
\fBWebsite\fR: https://rhysd\.github\.io/git\-brws
.
.IP "\(bu" 4
\fBBlame\fR: https://github\.com/rhysd/git\-brws/blame/9ab093f/src/service\.rs
.
.IP "" 0
.
.P
\fBgit\-brws\fR prefers permlink to the latest page since the latest page will change when new commit is pushed to the branch\.
.
.SH "SERVICES"
\fBgit\-brws\fR supports GitHub, GitHub Enterprise, BitBucket, GitLab as Git repository hosting services\.
.
.IP "\(bu" 4
\fBGitHub\fR: https://github\.com
.
.IP "\(bu" 4
\fBBitbucket\fR: https://bitbucket\.org
.
.IP "\(bu" 4
\fBGitHub Enterprise\fR: https://enterprise\.github\.com/home
.
.IP "\(bu" 4
\fBGitLab\fR: https://about\.gitlab\.com/
.
.IP "\(bu" 4
\fBAzure DevOps\fR: https://azure\.microsoft\.com/services/devops/
.
.IP "" 0
.
.SH "OPTIONS"
In addition to arguments described in \fISERVICES\fR, following options are available as command line arguments\. All are optional\.
.
.TP
\fB\-r\fR, \fB\-\-repo\fR \fIREPO\fR
Specify which repository should be open\. \fIREPO\fR is one of (1) shorthand format (repo, user/repo, host/user/repo) or (2) Git URL you want to see\. When only repository name is specified, \fBgit\-brws\fR searches GitHub with query \'{repo} in:name\' and opens the best\-matched repository page\.
.
.TP
\fB\-b\fR, \fB\-\-branch\fR \fIBRANCH\fR
Branch name to browse\.
.
.TP
\fB\-d\fR, \fB\-\-dir\fR \fIPATH\fR
Directory path to the repository\. Default value is current working directory\.
.
.TP
\fB\-R\fR, \fB\-\-remote\fR \fIREMOTE\fR
Remote name (e\.g\. origin)\. Default value is a remote the current branch is tracking\. If current branch tracks no branch, it falls back to \'origin\'\.
.
.TP
\fB\-u\fR, \fB\-\-url\fR
Output URL to stdout instead of opening in browser\.
.
.TP
\fB\-p\fR, \fB\-\-pr\fR
Open pull request page instead of repository page\. If not existing, open \'Create Pull Request\' page\.
.
.TP
\fB\-w\fR, \fB\-\-website\fR
Open website page instead of repository page (homepage URL for GitHub, GitLab pages, Bitbucket Cloud)
.
.TP
\fB\-B\fR, \fB\-\-blame\fR
Open blame page instead of repository page\. File path to blame must be passed also\.
.
.TP
\fB\-c\fR, \fB\-\-current\-branch\fR
Open the current branch instead of default branch\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Print this help\.
.
.TP
\fB\-v\fR, \fB\-\-version\fR
Show version\.
.
.SH "EXAMPLES"
.
.SS "Current repository page\."
.
.nf
$ git brws
.
.fi
.
.SS "\'develop\' branch\."
.
.nf
$ git brws \-b develop
.
.fi
.
.SS "\'origin\' remote of \'develop\' branch\."
.
.nf
$ git brws \-r origin \-b develop
.
.fi
.
.SS "@rhysd\'s \'Shiba\' repository on GitHub\."
.
.nf
$ git brws \-r rhysd/Shiba
.
.fi
.
.SS "Most popular \'react\' repository on GitHub"
.
.nf
$ git brws \-r react
.
.fi
.
.SS "Repository specified by directory\."
.
.nf
$ git brws \-d ~/\.go/src/github\.com/rhysd/dot\-github
.
.fi
.
.SS "File of current branch of current remote\."
.
.nf
$ git brws \./some/file\.txt
.
.fi
.
.SS "Line of the file\."
.
.nf
$ git brws \./some/file\.txt#L123
.
.fi
.
.P
\fINote:\fR The \'L\' can be omit\.
.
.SS "Range from line to line of the file\."
.
.nf
$ git brws \./some/file\.txt#L123\-L126
.
.fi
.
.P
\fINote:\fR The \'L\' can be omit\.
.
.SS "\'HEAD\' page of current repository\."
.
.nf
$ git brws HEAD
.
.fi
.
.SS "\'0\.10\.0\' tag page of current repository"
.
.nf
$ git brws 0\.10\.0
.
.fi
.
.SS "Diff between \'HEAD\' and \'HEAD~3\'\."
.
.nf
$ git brws HEAD~3\.\.HEAD
.
.fi
.
.SS "Diff between \'113079b\' and \'60024ab\'\."
.
.nf
$ git brws 60024ab\.\.113079b
.
.fi
.
.P
In addition to \'\.\.\', diff with \'\.\.\.\' is supported\.
.
.SS "Diff between \'branchB\' and the merge base commit from \'branchB\' into \'branchA\'"
.
.nf
$ git brws branchA\.\.\.branchB
.
.fi
.
.P
\fINote:\fR If you don\'t know the difference between \'\.\.\' and \'\.\.\.\', please read \'git diff \-\-help\'\.
.
.P
\fINote:\fR Only GitHub and GitHub Enterprise support \'\.\.\.\'\. For GitLab, only \'\.\.\.\' is available\.
.
.SS "Pull request page of current branch of current repository\."
.
.nf
$ git brws \-\-pr
.
.fi
.
.P
Note: When a pull request page for current branch is not existing yet, it opens \'Create Pull Request\' page instead\.
.
.SS "Pull request page of specific branch of specific repository\."
.
.nf
# Specify my forked repository
$ git brws \-\-pr \-\-repo rhysd/rust\.vim \-b async\-contextual\-keyword
# Or specify original repository
$ git brws \-\-pr \-\-repo rust\-lang/rust\.vim \-b async\-contextual\-keyword
.
.fi
.
.P
\fINote:\fR Currently only GitHub and GitHub Enterprise are supported\.
.
.P
\fINote:\fR If you have created multiple pull requests at the same repository with the same branch name, the command may not open a pull request page you want\.
.
.P
\fINote:\fR When a pull request page for current branch is not existing yet, it opens \'Create Pull Request\' page instead\.
.
.SS "Website for the repository"
.
.nf
# Website for current repository
$ git brws \-\-website
# Website of other repository
$ git brws \-\-website \-\-repo git\-brws
.
.fi
.
.P
\fINote:\fR It opens a website for the repository\.
.
.IP "\(bu" 4
For GitHub, URL for \'homepage\' configuration of the repository if it\'s set\. Otherwise \'https://{user}\.github\.io/{repo}\'
.
.IP "\(bu" 4
For GitHub Enterprise, \'https://pages\.{host}/{user}/{repo}\' or \'https://{host}/pages/{user}/{repo}\' depending on your GitHub Enterprise configuration of subdomain isolation
.
.IP "\(bu" 4
For GitLab, GitLab Pages
.
.IP "\(bu" 4
For Bitbucket, Bitbucket Cloud
.
.IP "" 0
.
.SS "An issue page\."
.
.nf
$ git brws \'#8\'
.
.fi
.
.P
\fINote:\fR \'#\' is usually used for a line comment in major shells\. Please quote the argument
.
.SS "Blame a file"
.
.nf
$ git brws \-\-blame some/file\.txt
.
.fi
.
.SS "Blame specific line of a file"
.
.nf
$ git brws \-\-blame some/file\.txt#L5
.
.fi
.
.SS "Blame specific range of a file"
.
.nf
$ git brws \-\-blame some/file\.txt#L5\-L9
.
.fi
.
.SH "ENVIRONMENT"
.
.TP
\fB$GIT_BRWS_GIT_COMMAND\fR
Git command to use\. If not specified, "git" will be used\.
.
.TP
\fB$GIT_BRWS_GHE_URL_HOST\fR
When you use your own GitHub Enterprise repository, you can specify its host to this variable\. By default, \fBgit\-brws\fR detects \'^github\.\' as GHE host\. If your GHE repository host does not match it, please specify this variable\. If your repository is \'https://example\-repo\.org/user/repo\', \'example\-repo\.org\' should be set\.
.
.TP
\fB$GIT_BRWS_GHE_SSH_PORT\fR
When you set a number to it, the number will be used for the ssh port for GitHub Enterprise URLs\.
.
.TP
\fB$GIT_BRWS_GITLAB_URL_HOST\fR
When you use self\-hosted GitLab instance, you can specify its host to this variable\. By default, \fBgit\-brws\fR detects host matching to \'^gitlab\.\' as GitLab\. If your GitLab URL host does not match it, please specify this variable\. If your repository is hosted at \'https://your\-code\.net/user/repo\', \'your\-code\.net\' should be set\.
.
.TP
\fB$GIT_BRWS_GITLAB_SSH_PORT\fR
When you set a number to it, the number will be used for the ssh port for self\-hosted GitLab URLs\. This is useful when your environment hosts GitLab to non\-trivial ssh port URL\.
.
.TP
\fB$GIT_BRWS_GITHUB_TOKEN\fR
This variable is used for \'\-\-pr\' (or \'\-p\') only\. API access token for github\.com\. They are optional, but useful for avoiding API rate limit and accessing to private repositories\. Please generate a token from https://github\.com/settings/tokens/new
.
.TP
\fB$GITHUB_TOKEN\fR
Ditto\. When $GIT_BRWS_GITHUB_TOKEN is not set, $GITHUB_TOKEN is looked\.
.
.TP
\fB$GIT_BRWS_GHE_TOKEN\fR
This variable is used for \'\-\-pr\' (or \'\-p\') only\. API access token for GitHub Enterprise instance\. It is sometimes mandatory (depending on your GHE instance configuration)\. Please generate a token from \'https://{YOUR GHE HOST}/settings/tokens/new\'\.
.
.TP
\fB$GIT_BRWS_BROWSE_COMMAND\fR
Command to open URL\. If this value is specified, the command is executed with URL as first argument to browse the URL\.
.
.TP
\fB$GIT_BRWS_SHORT_COMMIT_HASH\fR
Setting \'true\' will use 7\-letters short commit hash like \'78fbce6\' for URLs\.
.
.TP
\fB$https_proxy\fR
This variable is used for \'\-\-pr\' (or \'\-p\') only\. An HTTPS Proxy server URL if you use a web proxy\.
.
.SH "REPOSITORY"
\fBgit\-brws\fR is developed at repository hosted on GitHub\.
.
.P
https://github\.com/rhysd/git\-brws
.
.SH "BUGS"
Please visit issues page to see known bugs\. If you\'ve found a new bug, please report it here\.
.
.P
https://github\.com/rhysd/git\-brws/issues
.
.SH "COPYRIGHT"
\fBgit\-brws\fR is licensed under the MIT License Copyright (c) 2016 rhysd
.
.SH "SEE ALSO"
GIT(1)