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 Some command-specific key bindings may be prefixed with an integer, which is
59 denoted by N in the descriptions below, and is used as a modifier to the
60 operation as indicated.
61 When the first integer for a count modifier is entered,
62 .Nm
63 will wait 500 milliseconds for each successive integer or the compound sequence
64 to complete.
65 If this sequence should timeout or does not conclude with a valid key binding,
66 the command is aborted and any preceding count is reset.
67 The global key bindings are:
68 .Bl -tag -width Ds
69 .It Cm Q
70 Quit
71 .Nm .
72 .It Cm q
73 Quit the view which is in focus.
74 .It Cm Tab
75 Switch focus between views.
76 .It Cm F
77 Toggle fullscreen mode for a split-screen view.
78 .Nm
79 will automatically use split-screen views if the size of the terminal
80 window is sufficiently large.
81 .El
82 .Pp
83 Global options must precede the command name, and are as follows:
84 .Bl -tag -width tenletters
85 .It Fl h
86 Display usage information.
87 .It Fl V , -version
88 Display program version and exit immediately.
89 .El
90 .Pp
91 The commands for
92 .Nm
93 are as follows:
94 .Bl -tag -width blame
95 .It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
96 Display history of a repository.
97 If a
98 .Ar path
99 is specified, show only commits which modified this path.
100 If invoked in a work tree, the
101 .Ar path
102 is interpreted relative to the current working directory,
103 and the work tree's path prefix is implicitly prepended.
104 Otherwise, the path is interpreted relative to the repository root.
105 .Pp
106 This command is also executed if no explicit command is specified.
107 .Pp
108 The key bindings for
109 .Cm tog log
110 are as follows (N denotes optional prefixed count modifier):
111 .Bl -tag -width Ds
112 .It Cm Down-arrow, j, >, Full stop, Ctrl-n
113 Move the selection cursor down N lines (default: 1).
114 .It Cm Up-arrow, k, <, Comma, Ctrl-p
115 Move the selection cursor up N lines (default: 1).
116 .It Cm Right-arrow, l
117 Scroll log message field to the right N increments (default: 1).
118 .br
119 Log message moves left on the screen.
120 .It Cm Left-arrow, h
121 Scroll log message field to the left N increments (default: 1).
122 .br
123 Log message moves right on the screen.
124 .It Cm $
125 Scroll log message field to the rightmost position.
126 .It Cm 0
127 Scroll log message field to the leftmost position.
128 .It Cm Page-down, Space, Ctrl+f, f
129 Move the selection cursor down N pages (default: 1).
130 .It Cm Page-up, Ctrl+b, b
131 Move the selection cursor up N pages (default: 1).
132 .It Cm Ctrl+d, d
133 Move the selection cursor down N half pages (default: 1).
134 .It Cm Ctrl+u, u
135 Move the selection cursor up N half pages (default: 1).
136 .It Cm Home, g
137 Move the cursor to the newest commit.
138 .It Cm End, G
139 Move the cursor to the oldest commit.
140 This will traverse all commits on the current branch which may take
141 a long time depending on the number of commits in branch history.
142 If needed, this operation can be cancelled with
143 .Cm Backspace .
144 .It Cm Enter
145 Open a
146 .Cm diff
147 view showing file changes made in the currently selected commit.
148 .It Cm t
149 Open a
150 .Cm tree
151 view showing the tree for the currently selected commit.
152 .It Cm Backspace
153 Show log entries for the parent directory of the currently selected path.
154 However when an active search is in progress or when additional commits
155 are loaded,
156 .Cm Backspace
157 aborts the running operation.
158 .It Cm /
159 Prompt for a search pattern and start searching for matching commits.
160 The search pattern is an extended regular expression which is matched
161 against a commit's author name, committer name, log message, and
162 commit ID SHA1 hash.
163 Regular expression syntax is documented in
164 .Xr re_format 7 .
165 .It Cm n
166 Find the Nth next commit which matches the current search pattern (default: 1).
167 .br
168 Searching continues until either a match is found or the
169 .Cm Backspace
170 key is pressed.
171 .It Cm N
172 Find the Nth previous commit which matches the current search pattern
173 (default: 1).
174 .br
175 Searching continues until either a match is found or the
176 .Cm Backspace
177 key is pressed.
178 .It Cm Ctrl+l
179 Reload the
180 .Cm log
181 view with new commits found in the repository.
182 .It Cm B
183 Reload the
184 .Cm log
185 view and toggle display of merged commits.
186 The
187 .Fl b
188 option determines whether merged commits are displayed initially.
189 .It Cm r
190 Open a
191 .Cm ref
192 view listing all references in the repository.
193 This can then be used to open a new
194 .Cm log
195 view for arbitrary branches and tags.
196 .El
197 .Pp
198 The options for
199 .Cm tog log
200 are as follows:
201 .Bl -tag -width Ds
202 .It Fl b
203 Display individual commits which were merged into the current branch
204 from other branches.
205 By default,
206 .Cm tog log
207 shows the linear history of the current branch only.
208 The
209 .Cm B
210 key binding can be used to toggle display of merged commits at run-time.
211 .It Fl c Ar commit
212 Start traversing history at the specified
213 .Ar commit .
214 The expected argument is the name of a branch or a commit ID SHA1 hash.
215 An abbreviated hash argument will be expanded to a full SHA1 hash
216 automatically, provided the abbreviation is unique.
217 If this option is not specified, default to the work tree's current branch
218 if invoked in a work tree, or to the repository's HEAD reference.
219 .It Fl r Ar repository-path
220 Use the repository at the specified path.
221 If not specified, assume the repository is located at or above the current
222 working directory.
223 If this directory is a
224 .Xr got 1
225 work tree, use the repository path associated with this work tree.
226 .El
227 .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
228 Display the differences between two objects in the repository.
229 Treat each of the two arguments as a reference, a tag name, or an object
230 ID SHA1 hash, and display differences between the corresponding objects.
231 Both objects must be of the same type (blobs, trees, or commits).
232 An abbreviated hash argument will be expanded to a full SHA1 hash
233 automatically, provided the abbreviation is unique.
234 .Pp
235 The key bindings for
236 .Cm tog diff
237 are as follows (N denotes optional prefixed count modifier):
238 .Bl -tag -width Ds
239 .It Cm a
240 Toggle treatment of file contents as ASCII text even if binary data was
241 detected.
242 .It Cm Down-arrow, j, Ctrl-n
243 Scroll down N lines (default: 1).
244 .It Cm Up-arrow, k, Ctrl-p
245 Scroll up N lines (default: 1).
246 .It Cm Right-arrow, l
247 Scroll view to the right N increments (default: 1).
248 .br
249 Diff output moves left on the screen.
250 .It Cm Left-arrow, h
251 Scroll view to the left N increments (default: 1).
252 .br
253 Diff output moves right on the screen.
254 .It Cm $
255 Scroll view to the rightmost position.
256 .It Cm 0
257 Scroll view left to the start of the line.
258 .It Cm Page-down, Space, Ctrl+f, f
259 Scroll down N pages (default: 1).
260 .It Cm Page-up, Ctrl+b, b
261 Scroll up N pages (default: 1).
262 .It Cm Ctrl+d, d
263 Scroll down N half pages (default: 1).
264 .It Cm Ctrl+u, u
265 Scroll up N half pages (default: 1).
266 .It Cm Home, g
267 Scroll to the top of the view.
268 .It Cm End, G
269 Scroll to the bottom of the view.
270 .It Cm \&[
271 Reduce diff context by N lines (default: 1).
272 .It Cm \&]
273 Increase diff context by N lines (default: 1).
274 .It Cm <, Comma
275 If the
276 .Cm diff
277 view was opened via the
278 .Cm log
279 view, move to the Nth previous (younger) commit (default: 1).
280 .It Cm >, Full stop
281 If the
282 .Cm diff
283 view was opened via the
284 .Cm log
285 view, move to the Nth next (older) commit (default: 1).
286 .It Cm /
287 Prompt for a search pattern and start searching for matching lines.
288 The search pattern is an extended regular expression.
289 Regular expression syntax is documented in
290 .Xr re_format 7 .
291 .It Cm n
292 Find the Nth next line which matches the current search pattern (default: 1).
293 .It Cm N
294 Find the Nth previous line which matches the current search pattern
295 (default: 1).
296 .It Cm w
297 Toggle display of whitespace-only changes.
298 .It Cm A
299 Change the diff algorithm.
300 Supported diff algorithms are Myers and Patience.
301 This is a global setting which also affects the
302 .Cm blame
303 view.
304 .El
305 .Pp
306 The options for
307 .Cm tog diff
308 are as follows:
309 .Bl -tag -width Ds
310 .It Fl a
311 Treat file contents as ASCII text even if binary data is detected.
312 .It Fl C Ar number
313 Set the number of context lines shown in the diff.
314 By default, 3 lines of context are shown.
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 .It Fl w
323 Ignore whitespace-only changes.
324 .El
325 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
326 Display line-by-line history of a file at the specified path.
327 .Pp
328 The key bindings for
329 .Cm tog blame
330 are as follows (N denotes optional prefixed count modifier):
331 .Bl -tag -width Ds
332 .It Cm Down-arrow, j, Ctrl-n
333 Move the selection cursor down N pages (default: 1).
334 .It Cm Up-arrow, k, Ctrl-p
335 Move the selection cursor up N pages (default: 1).
336 .It Cm Right-arrow, l
337 Scroll view to the right N increments (default: 1).
338 .br
339 File output moves left on the screen.
340 .It Cm Left-arrow, h
341 Scroll view to the left N increments (default: 1).
342 .br
343 File output moves right on the screen.
344 .It Cm $
345 Scroll view to the rightmost position.
346 .It Cm 0
347 Scroll view left to the start of the line.
348 .It Cm Page-down, Space, Ctrl+f, f
349 Move the selection cursor down N pages (default: 1).
350 .It Cm Page-up, Ctrl+b, b
351 Move the selection cursor up N pages (default: 1).
352 .It Cm Ctrl+d, d
353 Move the selection cursor down N half pages (default: 1).
354 .It Cm Ctrl+u, u
355 Move the selection cursor up N half pages (default: 1).
356 .It Cm Home, g
357 Move the selection cursor to the first line of the file.
358 .It Cm End, G
359 Move the selection cursor to the last line of the file.
360 .It Cm Enter
361 Open a
362 .Cm diff
363 view for the currently selected line's commit.
364 .It Cm c
365 Reload the
366 .Cm blame
367 view with the version of the file as found in the currently
368 selected line's commit.
369 .It Cm p
370 Reload the
371 .Cm blame
372 view with the version of the file as found in the parent commit of the
373 currently selected line's commit.
374 .It Cm C
375 Reload the
376 .Cm blame
377 view with the previously blamed commit.
378 .It Cm /
379 Prompt for a search pattern and start searching for matching lines.
380 The search pattern is an extended regular expression.
381 Regular expression syntax is documented in
382 .Xr re_format 7 .
383 .It Cm n
384 Find the Nth next line which matches the current search pattern (default: 1).
385 .It Cm N
386 Find the Nth previous line which matches the current search pattern
387 (default: 1).
388 .It Cm A
389 Change the diff algorithm.
390 Supported diff algorithms are Myers and Patience.
391 This is a global setting which also affects the
392 .Cm diff
393 view.
394 .El
395 .Pp
396 The options for
397 .Cm tog blame
398 are as follows:
399 .Bl -tag -width Ds
400 .It Fl c Ar commit
401 Start traversing history at the specified
402 .Ar commit .
403 The expected argument is the name of a branch or a commit ID SHA1 hash.
404 An abbreviated hash argument will be expanded to a full SHA1 hash
405 automatically, provided the abbreviation is unique.
406 .It Fl r Ar repository-path
407 Use the repository at the specified path.
408 If not specified, assume the repository is located at or above the current
409 working directory.
410 If this directory is a
411 .Xr got 1
412 work tree, use the repository path associated with this work tree.
413 .El
414 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
415 Display the repository tree.
416 If a
417 .Ar path
418 is specified, show tree entries at this path.
419 .Pp
420 Displayed tree entries may carry one of the following trailing annotations:
421 .Bl -column YXZ description
422 .It @ Ta entry is a symbolic link
423 .It / Ta entry is a directory
424 .It * Ta entry is an executable file
425 .It $ Ta entry is a Git submodule
426 .El
427 .Pp
428 Symbolic link entries are also annotated with the target path of the link.
429 .Pp
430 The key bindings for
431 .Cm tog tree
432 are as follows (N denotes optional prefixed count modifier):
433 .Bl -tag -width Ds
434 .It Cm Down-arrow, j, Ctrl-n
435 Move the selection cursor down N lines (default: 1).
436 .It Cm Up-arrow, k, Ctrl-p
437 Move the selection cursor up N lines (default: 1).
438 .It Cm Page-down, Space, Ctrl+f, f
439 Move the selection cursor down N pages (default: 1).
440 .It Cm Page-up, Ctrl+b, b
441 Move the selection cursor up N pages (default: 1).
442 .It Cm Ctrl+d, d
443 Move the selection cursor down N half pages (default: 1).
444 .It Cm Ctrl+u, u
445 Move the selection cursor up N half pages (default: 1).
446 .It Cm Home, g
447 Move the selection cursor to the first entry.
448 .It Cm End, G
449 Move the selection cursor to the last entry.
450 .It Cm Enter
451 Enter the currently selected directory, or switch to the
452 .Cm blame
453 view for the currently selected file.
454 .It Cm l
455 Open a
456 .Cm log
457 view for the currently selected tree entry.
458 .It Cm r
459 Open a
460 .Cm ref
461 view listing all references in the repository.
462 This can then be used to open a new
463 .Cm tree
464 view for arbitrary branches and tags.
465 .It Cm Backspace
466 Move back to the Nth parent directory (default: 1).
467 .It Cm i
468 Show object IDs for all objects displayed in the
469 .Cm tree
470 view.
471 .It Cm /
472 Prompt for a search pattern and start searching for matching tree entries.
473 The search pattern is an extended regular expression which is matched
474 against the tree entry's name.
475 Regular expression syntax is documented in
476 .Xr re_format 7 .
477 .It Cm n
478 Find the Nth next tree entry which matches the current search pattern
479 (default: 1).
480 .It Cm N
481 Find the Nth previous tree entry which matches the current search pattern
482 (default: 1).
483 .El
484 .Pp
485 The options for
486 .Cm tog tree
487 are as follows:
488 .Bl -tag -width Ds
489 .It Fl c Ar commit
490 Start traversing history at the specified
491 .Ar commit .
492 The expected argument is the name of a branch or a commit ID SHA1 hash.
493 An abbreviated hash argument will be expanded to a full SHA1 hash
494 automatically, provided the abbreviation is unique.
495 .It Fl r Ar repository-path
496 Use the repository at the specified path.
497 If not specified, assume the repository is located at or above the current
498 working directory.
499 If this directory is a
500 .Xr got 1
501 work tree, use the repository path associated with this work tree.
502 .El
503 .It Cm ref Oo Fl r Ar repository-path Oc
504 Display references in the repository.
505 .Pp
506 The key bindings for
507 .Cm tog ref
508 are as follows (N denotes optional prefixed count modifier):
509 .Bl -tag -width Ds
510 .It Cm Down-arrow, j, Ctrl-n
511 Move the selection cursor down N lines (default: 1).
512 .It Cm Up-arrow, k, Ctrl-p
513 Move the selection cursor up N lines (default: 1).
514 .It Cm Page-down, Space, Ctrl+f, f
515 Move the selection cursor down N pages (default: 1).
516 .It Cm Page-up, Ctrl+b, b
517 Move the selection cursor up N pages (default: 1).
518 .It Cm Ctrl+d, d
519 Move the selection cursor down N half pages (default: 1).
520 .It Cm Ctrl+u, u
521 Move the selection cursor up N half pages (default: 1).
522 .It Cm Home, g
523 Move the selection cursor to the first reference.
524 .It Cm End, G
525 Move the selection cursor to the last reference.
526 .It Cm Enter
527 Open a
528 .Cm log
529 view which begins traversing history at the commit resolved via the
530 currently selected reference.
531 .It Cm t
532 Open a
533 .Cm tree
534 view showing the tree resolved via the currently selected reference.
535 .It Cm i
536 Show object IDs for all non-symbolic references displayed in the
537 .Cm ref
538 view.
539 .It Cm m
540 Show last modified date of each displayed reference.
541 .It Cm o
542 Toggle display order of references between sort by name and sort by timestamp.
543 .It Cm /
544 Prompt for a search pattern and start searching for matching references.
545 The search pattern is an extended regular expression which is matched
546 against absolute reference names.
547 Regular expression syntax is documented in
548 .Xr re_format 7 .
549 .It Cm n
550 Find the Nth next reference which matches the current search pattern
551 (default: 1).
552 .It Cm N
553 Find the Nth previous reference which matches the current search pattern
554 (default: 1).
555 .It Cm Ctrl+l
556 Reload the list of references displayed by the
557 .Cm ref
558 view.
559 .El
560 .Pp
561 The options for
562 .Cm tog ref
563 are as follows:
564 .Bl -tag -width Ds
565 .It Fl r Ar repository-path
566 Use the repository at the specified path.
567 If not specified, assume the repository is located at or above the current
568 working directory.
569 If this directory is a
570 .Xr got 1
571 work tree, use the repository path associated with this work tree.
572 .El
573 .El
574 .Sh ENVIRONMENT
575 .Bl -tag -width TOG_DIFF_ALGORITHM
576 .It Ev TOG_DIFF_ALGORITHM
577 Determines the default diff algorithm used by
578 .Nm .
579 Valid values are
580 .Dq patience
581 and
582 .Dq myers .
583 If unset, the Myers diff algorithm will be used by default.
584 .It Ev TOG_COLORS
585 .Nm
586 shows colorized output if this variable is set to a non-empty value.
587 The default color scheme can be modified by setting the environment
588 variables documented below.
589 The colors available in color schemes are
590 .Dq black ,
591 .Dq red ,
592 .Dq green ,
593 .Dq yellow ,
594 .Dq blue ,
595 .Dq magenta ,
596 .Dq cyan ,
597 and
598 .Dq default
599 which maps to the terminal's default foreground color.
600 .It Ev TOG_COLOR_DIFF_MINUS
601 The color used to mark up removed lines in diffs.
602 If not set, the default value
603 .Dq magenta
604 is used.
605 .It Ev TOG_COLOR_DIFF_PLUS
606 The color used to mark up added lines in diffs.
607 If not set, the default value
608 .Dq cyan
609 is used.
610 .It Ev TOG_COLOR_DIFF_CHUNK_HEADER
611 The color used to mark up chunk header lines in diffs.
612 If not set, the default value
613 .Dq yellow
614 is used.
615 .It Ev TOG_COLOR_DIFF_META
616 The color used to mark up meta data in diffs.
617 If not set, the default value
618 .Dq green
619 is used.
620 .It Ev TOG_COLOR_TREE_SUBMODULE
621 The color used to mark up submodule tree entries.
622 If not set, the default value
623 .Dq magenta
624 is used.
625 .It Ev TOG_COLOR_TREE_SYMLINK
626 The color used to mark up symbolic link tree entries.
627 If not set, the default value
628 .Dq magenta
629 is used.
630 .It Ev TOG_COLOR_TREE_DIRECTORY
631 The color used to mark up directory tree entries.
632 If not set, the default value
633 .Dq cyan
634 is used.
635 .It Ev TOG_COLOR_TREE_EXECUTABLE
636 The color used to mark up executable file tree entries.
637 If not set, the default value
638 .Dq green
639 is used.
640 .It Ev TOG_COLOR_COMMIT
641 The color used to mark up commit IDs.
642 If not set, the default value
643 .Dq green
644 is used.
645 .It Ev TOG_COLOR_AUTHOR
646 The color used to mark up author information.
647 If not set, the default value
648 .Dq cyan
649 is used.
650 .It Ev TOG_COLOR_DATE
651 The color used to mark up date information.
652 If not set, the default value
653 .Dq yellow
654 is used.
655 .It Ev TOG_COLOR_REFS_HEADS
656 The color used to mark up references in the
657 .Dq refs/heads/
658 namespace.
659 If not set, the default value
660 .Dq green
661 is used.
662 .It Ev TOG_COLOR_REFS_TAGS
663 The color used to mark up references in the
664 .Dq refs/tags/
665 namespace.
666 If not set, the default value
667 .Dq magenta
668 is used.
669 .It Ev TOG_COLOR_REFS_REMOTES
670 The color used to mark up references in the
671 .Dq refs/remotes/
672 namespace.
673 If not set, the default value
674 .Dq yellow
675 is used.
676 .It Ev TOG_COLOR_REFS_BACKUP
677 The color used to mark up references in the
678 .Dq refs/got/backup/
679 namespace.
680 If not set, the default value
681 .Dq cyan
682 is used.
683 .El
684 .Sh EXIT STATUS
685 .Ex -std tog
686 .Sh SEE ALSO
687 .Xr got 1 ,
688 .Xr git-repository 5 ,
689 .Xr re_format 7
690 .Sh AUTHORS
691 .An Stefan Sperling Aq Mt stsp@openbsd.org
692 .An Joshua Stein Aq Mt jcs@openbsd.org