Blob


1 .\"
2 .\" Copyright (c) 2018 Stefan Sperling
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .Dd $Mdocdate$
17 .Dt TOG 1
18 .Os
19 .Sh NAME
20 .Nm tog
21 .Nd Git repository browser
22 .Sh SYNOPSIS
23 .Nm
24 .Op Ar command
25 .Op Fl h
26 .Op Ar arg ...
27 .Pp
28 .Nm
29 .Ar path
30 .Sh DESCRIPTION
31 .Nm
32 is an interactive read-only browser for Git repositories.
33 This repository format is described in
34 .Xr git-repository 5 .
35 .Pp
36 .Nm
37 supports several types of views which display repository data:
38 .Bl -tag -width Ds
39 .It Log view
40 Displays commits in the repository's history.
41 This view is displayed initially if no
42 .Ar command
43 is specified, or if just a
44 .Ar path
45 is specified.
46 .It Diff view
47 Displays changes made in a particular commit.
48 .It Blame view
49 Displays the line-by-line history of a file.
50 .It Tree view
51 Displays the tree corresponding to a particular commit.
52 .It Ref view
53 Displays references in the repository.
54 .El
55 .Pp
56 .Nm
57 provides global and command-specific key bindings and options.
58 The global key bindings are:
59 .Bl -tag -width Ds
60 .It Cm Q
61 Quit
62 .Nm .
63 .It Cm q
64 Quit the view which is in focus.
65 .It Cm Tab
66 Switch focus between views.
67 .It Cm f
68 Toggle fullscreen mode for a split-screen view.
69 .Nm
70 will automatically use split-screen views if the size of the terminal
71 window is sufficiently large.
72 .El
73 .Pp
74 Global options must precede the command name, and are as follows:
75 .Bl -tag -width tenletters
76 .It Fl h
77 Display usage information.
78 .It Fl V , -version
79 Display program version and exit immediately.
80 .El
81 .Pp
82 The commands for
83 .Nm
84 are as follows:
85 .Bl -tag -width blame
86 .It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
87 Display history of a repository.
88 If a
89 .Ar path
90 is specified, show only commits which modified this path.
91 If invoked in a work tree, the
92 .Ar path
93 is interpreted relative to the current working directory,
94 and the work tree's path prefix is implicitly prepended.
95 Otherwise, the path is interpreted relative to the repository root.
96 .Pp
97 This command is also executed if no explicit command is specified.
98 .Pp
99 The key bindings for
100 .Cm tog log
101 are as follows:
102 .Bl -tag -width Ds
103 .It Cm Down-arrow, j, >, Full stop
104 Move the selection cursor down.
105 .It Cm Up-arrow, k, <, Comma
106 Move the selection cursor up.
107 .It Cm Page-down, Ctrl+f
108 Move the selection cursor down one page.
109 .It Cm Page-up, Ctrl+b
110 Move the selection cursor up one page.
111 .It Cm Enter, Space
112 Open a
113 .Cm diff
114 view showing file changes made in the currently selected commit.
115 .It Cm t
116 Open a
117 .Cm tree
118 view showing the tree for the currently selected commit.
119 .It Cm Backspace
120 Show log entries for the parent directory of the currently selected path,
121 unless an active search is in progress in which case
122 .Cm Backspace
123 aborts the search.
124 .It Cm /
125 Prompt for a search pattern and start searching for matching commits.
126 The search pattern is an extended regular expression which is matched
127 against a commit's author name, committer name, log message, and
128 commit ID SHA1 hash.
129 Regular expression syntax is documented in
130 .Xr re_format 7 .
131 .It Cm n
132 Find the next commit which matches the current search pattern.
133 Searching continues until either a match is found or the
134 .Cm Backspace
135 key is pressed.
136 .It Cm N
137 Find the previous commit which matches the current search pattern.
138 Searching continues until either a match is found or the
139 .Cm Backspace
140 key is pressed.
141 .It Cm Ctrl+l
142 Reload the
143 .Cm log
144 view with new commits found in the repository.
145 .It Cm B
146 Reload the
147 .Cm log
148 view and toggle display of merged commits.
149 The
150 .Fl b
151 option determines whether merged commits are displayed initially.
152 .It Cm r
153 Open a
154 .Cm ref
155 view listing all references in the repository.
156 This can then be used to open a new
157 .Cm log
158 view for arbitrary branches and tags.
159 .El
160 .Pp
161 The options for
162 .Cm tog log
163 are as follows:
164 .Bl -tag -width Ds
165 .It Fl b
166 Display individual commits which were merged into the current branch
167 from other branches.
168 By default,
169 .Cm tog log
170 shows the linear history of the current branch only.
171 The
172 .Cm B
173 key binding can be used to toggle display of merged commits at run-time.
174 .It Fl c Ar commit
175 Start traversing history at the specified
176 .Ar commit .
177 The expected argument is the name of a branch or a commit ID SHA1 hash.
178 An abbreviated hash argument will be expanded to a full SHA1 hash
179 automatically, provided the abbreviation is unique.
180 If this option is not specified, default to the work tree's current branch
181 if invoked in a work tree, or to the repository's HEAD reference.
182 .It Fl r Ar repository-path
183 Use the repository at the specified path.
184 If not specified, assume the repository is located at or above the current
185 working directory.
186 If this directory is a
187 .Xr got 1
188 work tree, use the repository path associated with this work tree.
189 .El
190 .It Cm diff Oo Fl a Oc Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl w Oc Ar object1 Ar object2
191 Display the differences between two objects in the repository.
192 Treat each of the two arguments as a reference, a tag name, or an object
193 ID SHA1 hash, and display differences between the corresponding objects.
194 Both objects must be of the same type (blobs, trees, or commits).
195 An abbreviated hash argument will be expanded to a full SHA1 hash
196 automatically, provided the abbreviation is unique.
197 .Pp
198 The key bindings for
199 .Cm tog diff
200 are as follows:
201 .Bl -tag -width Ds
202 .It Cm a
203 Toggle treatment of file contents as ASCII text even if binary data was
204 detected.
205 .It Cm Down-arrow, j
206 Scroll down.
207 .It Cm Up-arrow, k
208 Scroll up.
209 .It Cm Page-down, Space, Ctrl+f
210 Scroll down one page.
211 .It Cm Page-up, Ctrl+b
212 Scroll up one page.
213 .It Cm \&[
214 Reduce the amount of diff context lines.
215 .It Cm \&]
216 Increase the amount of diff context lines.
217 .It Cm <, Comma
218 If the
219 .Cm diff
220 view was opened via the
221 .Cm log
222 view, move to the previous (younger) commit.
223 .It Cm >, Full stop
224 If the
225 .Cm diff
226 view was opened via the
227 .Cm log
228 view, move to the next (older) commit.
229 .It Cm /
230 Prompt for a search pattern and start searching for matching lines.
231 The search pattern is an extended regular expression.
232 Regular expression syntax is documented in
233 .Xr re_format 7 .
234 .It Cm n
235 Find the next line which matches the current search pattern.
236 .It Cm N
237 Find the previous line which matches the current search pattern.
238 .It Cm w
239 Toggle display of whitespace-only changes.
240 .El
241 .Pp
242 The options for
243 .Cm tog diff
244 are as follows:
245 .Bl -tag -width Ds
246 .It Fl a
247 Treat file contents as ASCII text even if binary data is detected.
248 .It Fl C Ar number
249 Set the number of context lines shown in the diff.
250 By default, 3 lines of context are shown.
251 .It Fl r Ar repository-path
252 Use the repository at the specified path.
253 If not specified, assume the repository is located at or above the current
254 working directory.
255 If this directory is a
256 .Xr got 1
257 work tree, use the repository path associated with this work tree.
258 .It Fl w
259 Ignore whitespace-only changes.
260 .El
261 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
262 Display line-by-line history of a file at the specified path.
263 .Pp
264 The key bindings for
265 .Cm tog blame
266 are as follows:
267 .Bl -tag -width Ds
268 .It Cm Down-arrow, j
269 Move the selection cursor down.
270 .It Cm Up-arrow, k
271 Move the selection cursor up.
272 .It Cm Page-down, Space, Ctrl+f
273 Move the selection cursor down one page.
274 .It Cm Page-up, Ctrl+b
275 Move the selection cursor up one page.
276 .It Cm Enter
277 Open a
278 .Cm diff
279 view for the currently selected line's commit.
280 .It Cm b
281 Reload the
282 .Cm blame
283 view with the version of the file as found in the currently
284 selected line's commit.
285 .It Cm p
286 Reload the
287 .Cm blame
288 view with the version of the file as found in the parent commit of the
289 currently selected line's commit.
290 .It Cm B
291 Reload the
292 .Cm blame
293 view with the previously blamed commit.
294 .It Cm /
295 Prompt for a search pattern and start searching for matching lines.
296 The search pattern is an extended regular expression.
297 Regular expression syntax is documented in
298 .Xr re_format 7 .
299 .It Cm n
300 Find the next line which matches the current search pattern.
301 .It Cm N
302 Find the previous line which matches the current search pattern.
303 .El
304 .Pp
305 The options for
306 .Cm tog blame
307 are as follows:
308 .Bl -tag -width Ds
309 .It Fl c Ar commit
310 Start traversing history at the specified
311 .Ar commit .
312 The expected argument is the name of a branch or a commit ID SHA1 hash.
313 An abbreviated hash argument will be expanded to a full SHA1 hash
314 automatically, provided the abbreviation is unique.
315 .It Fl r Ar repository-path
316 Use the repository at the specified path.
317 If not specified, assume the repository is located at or above the current
318 working directory.
319 If this directory is a
320 .Xr got 1
321 work tree, use the repository path associated with this work tree.
322 .El
323 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
324 Display the repository tree.
325 If a
326 .Ar path
327 is specified, show tree entries at this path.
328 .Pp
329 Displayed tree entries may carry one of the following trailing annotations:
330 .Bl -column YXZ description
331 .It @ Ta entry is a symbolic link
332 .It / Ta entry is a directory
333 .It * Ta entry is an executable file
334 .It $ Ta entry is a Git submodule
335 .El
336 .Pp
337 Symbolic link entries are also annotated with the target path of the link.
338 .Pp
339 The key bindings for
340 .Cm tog tree
341 are as follows:
342 .Bl -tag -width Ds
343 .It Cm Down-arrow, j
344 Move the selection cursor down.
345 .It Cm Up-arrow, k
346 Move the selection cursor up.
347 .It Cm Page-down, Ctrl+f
348 Move the selection cursor down one page.
349 .It Cm Page-up, Ctrl+b
350 Move the selection cursor up one page.
351 .It Cm Enter
352 Enter the currently selected directory, or switch to the
353 .Cm blame
354 view for the currently selected file.
355 .It Cm l
356 Open a
357 .Cm log
358 view for the currently selected tree entry.
359 .It Cm r
360 Open a
361 .Cm ref
362 view listing all references in the repository.
363 This can then be used to open a new
364 .Cm tree
365 view for arbitrary branches and tags.
366 .It Cm Backspace
367 Move back to the parent directory.
368 .It Cm i
369 Show object IDs for all objects displayed in the
370 .Cm tree
371 view.
372 .It Cm /
373 Prompt for a search pattern and start searching for matching tree entries.
374 The search pattern is an extended regular expression which is matched
375 against the tree entry's name.
376 Regular expression syntax is documented in
377 .Xr re_format 7 .
378 .It Cm n
379 Find the next tree entry which matches the current search pattern.
380 .It Cm N
381 Find the previous tree entry which matches the current search pattern.
382 .El
383 .Pp
384 The options for
385 .Cm tog tree
386 are as follows:
387 .Bl -tag -width Ds
388 .It Fl c Ar commit
389 Start traversing history at the specified
390 .Ar commit .
391 The expected argument is the name of a branch or a commit ID SHA1 hash.
392 An abbreviated hash argument will be expanded to a full SHA1 hash
393 automatically, provided the abbreviation is unique.
394 .It Fl r Ar repository-path
395 Use the repository at the specified path.
396 If not specified, assume the repository is located at or above the current
397 working directory.
398 If this directory is a
399 .Xr got 1
400 work tree, use the repository path associated with this work tree.
401 .El
402 .It Cm ref Oo Fl r Ar repository-path Oc
403 Display references in the repository.
404 .Pp
405 The key bindings for
406 .Cm tog ref
407 are as follows:
408 .Bl -tag -width Ds
409 .It Cm Down-arrow, j
410 Move the selection cursor down.
411 .It Cm Up-arrow, k
412 Move the selection cursor up.
413 .It Cm Page-down, Ctrl+f
414 Move the selection cursor down one page.
415 .It Cm Page-up, Ctrl+b
416 Move the selection cursor up one page.
417 .It Cm Enter
418 Open a
419 .Cm log
420 view which begins traversing history at the commit resolved via the
421 currently selected reference.
422 .It Cm t
423 Open a
424 .Cm tree
425 view showing the tree resolved via the currently selected reference.
426 .It Cm i
427 Show object IDs for all non-symbolic references displayed in the
428 .Cm ref
429 view.
430 .It Cm /
431 Prompt for a search pattern and start searching for matching references.
432 The search pattern is an extended regular expression which is matched
433 against absolute reference names.
434 Regular expression syntax is documented in
435 .Xr re_format 7 .
436 .It Cm n
437 Find the next reference which matches the current search pattern.
438 .It Cm N
439 Find the previous reference which matches the current search pattern.
440 .It Cm Ctrl+l
441 Reload the list of references displayed by the
442 .Cm ref
443 view.
444 .El
445 .Pp
446 The options for
447 .Cm tog ref
448 are as follows:
449 .Bl -tag -width Ds
450 .It Fl r Ar repository-path
451 Use the repository at the specified path.
452 If not specified, assume the repository is located at or above the current
453 working directory.
454 If this directory is a
455 .Xr got 1
456 work tree, use the repository path associated with this work tree.
457 .El
458 .El
459 .Sh ENVIRONMENT
460 .Bl -tag -width TOG_COLORS
461 .It Ev TOG_COLORS
462 .Nm
463 shows colorized output if this variable is set to a non-empty value.
464 The default color scheme can be modified by setting the environment
465 variables documented below.
466 The colors available in color schemes are
467 .Dq black ,
468 .Dq red ,
469 .Dq green ,
470 .Dq yellow ,
471 .Dq blue ,
472 .Dq megenta ,
473 .Dq cyan ,
474 and
475 .Dq default
476 which maps to the terminal's default foreground color.
477 .It Ev TOG_COLOR_DIFF_MINUS
478 The color used to mark up removed lines in diffs.
479 If not set, the default value
480 .Dq magenta
481 is used.
482 .It Ev TOG_COLOR_DIFF_PLUS
483 The color used to mark up added lines in diffs.
484 If not set, the default value
485 .Dq cyan
486 is used.
487 .It Ev TOG_COLOR_DIFF_CHUNK_HEADER
488 The color used to mark up chunk header lines in diffs.
489 If not set, the default value
490 .Dq yellow
491 is used.
492 .It Ev TOG_COLOR_DIFF_META
493 The color used to mark up meta data in diffs.
494 If not set, the default value
495 .Dq green
496 is used.
497 .It Ev TOG_COLOR_TREE_SUBMODULE
498 The color used to mark up sobmodules tree entries.
499 If not set, the default value
500 .Dq magenta
501 is used.
502 .It Ev TOG_COLOR_TREE_SYMLINK
503 The color used to mark up symbolic link tree entries.
504 If not set, the default value
505 .Dq magenta
506 is used.
507 .It Ev TOG_COLOR_TREE_DIRECTORY
508 The color used to mark up directory tree entries.
509 If not set, the default value
510 .Dq cyan
511 is used.
512 .It Ev TOG_COLOR_TREE_EXECUTABLE
513 The color used to mark up executable file tree entries.
514 If not set, the default value
515 .Dq green
516 is used.
517 .It Ev TOG_COLOR_COMMIT
518 The color used to mark up commit IDs.
519 If not set, the default value
520 .Dq green
521 is used.
522 .It Ev TOG_COLOR_AUTHOR
523 The color used to mark up author information.
524 If not set, the default value
525 .Dq cyan
526 is used.
527 .It Ev TOG_COLOR_DATE
528 The color used to mark up date information.
529 If not set, the default value
530 .Dq yellow
531 is used.
532 .It Ev TOG_COLOR_REFS_HEADS
533 The color used to mark up references in the
534 .Dq refs/heads/
535 namespace.
536 If not set, the default value
537 .Dq green
538 is used.
539 .It Ev TOG_COLOR_REFS_TAGS
540 The color used to mark up references in the
541 .Dq refs/tags/
542 namespace.
543 If not set, the default value
544 .Dq magenta
545 is used.
546 .It Ev TOG_COLOR_REFS_REMOTES
547 The color used to mark up references in the
548 .Dq refs/remotes/
549 namespace.
550 If not set, the default value
551 .Dq yellow
552 is used.
553 .El
554 .Sh EXIT STATUS
555 .Ex -std tog
556 .Sh SEE ALSO
557 .Xr got 1 ,
558 .Xr git-repository 5 ,
559 .Xr re_format 7
560 .Sh AUTHORS
561 .An Stefan Sperling Aq Mt stsp@openbsd.org
562 .An Joshua Stein Aq Mt jcs@openbsd.org