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