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 and Patience.
309 This is a global setting which also affects the
310 .Cm blame
311 view.
312 .El
313 .Pp
314 The options for
315 .Cm tog diff
316 are as follows:
317 .Bl -tag -width Ds
318 .It Fl a
319 Treat file contents as ASCII text even if binary data is detected.
320 .It Fl C Ar number
321 Set the number of context lines shown in the diff.
322 By default, 3 lines of context are shown.
323 .It Fl r Ar repository-path
324 Use the repository at the specified path.
325 If not specified, assume the repository is located at or above the current
326 working directory.
327 If this directory is a
328 .Xr got 1
329 work tree, use the repository path associated with this work tree.
330 .It Fl w
331 Ignore whitespace-only changes.
332 .El
333 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
334 Display line-by-line history of a file at the specified path.
335 .Pp
336 The key bindings for
337 .Cm tog blame
338 are as follows (N denotes optional prefixed count modifier):
339 .Bl -tag -width Ds
340 .It Cm Down-arrow, j, Ctrl-n
341 Move the selection cursor down N pages (default: 1).
342 .It Cm Up-arrow, k, Ctrl-p
343 Move the selection cursor up N pages (default: 1).
344 .It Cm Right-arrow, l
345 Scroll view to the right N increments (default: 1).
346 .br
347 File output moves left on the screen.
348 .It Cm Left-arrow, h
349 Scroll view to the left N increments (default: 1).
350 .br
351 File output moves right on the screen.
352 .It Cm $
353 Scroll view to the rightmost position.
354 .It Cm 0
355 Scroll view left to the start of the line.
356 .It Cm Page-down, Space, Ctrl+f, f
357 Move the selection cursor down N pages (default: 1).
358 .It Cm Page-up, Ctrl+b, b
359 Move the selection cursor up N pages (default: 1).
360 .It Cm Ctrl+d, d
361 Move the selection cursor down N half pages (default: 1).
362 .It Cm Ctrl+u, u
363 Move the selection cursor up N half pages (default: 1).
364 .It Cm Home, g
365 Move the selection cursor to the first line of the file.
366 .It Cm End, G
367 Move the selection cursor to the last line of the file.
368 .It Cm Enter
369 Open a
370 .Cm diff
371 view for the currently selected line's commit.
372 .It Cm c
373 Reload the
374 .Cm blame
375 view with the version of the file as found in the currently
376 selected line's commit.
377 .It Cm p
378 Reload the
379 .Cm blame
380 view with the version of the file as found in the parent commit of the
381 currently selected line's commit.
382 .It Cm C
383 Reload the
384 .Cm blame
385 view with the previously blamed commit.
386 .It Cm /
387 Prompt for a search pattern and start searching for matching lines.
388 The search pattern is an extended regular expression.
389 Regular expression syntax is documented in
390 .Xr re_format 7 .
391 .It Cm n
392 Find the Nth next line which matches the current search pattern (default: 1).
393 .It Cm N
394 Find the Nth previous line which matches the current search pattern
395 (default: 1).
396 .It Cm A
397 Change the diff algorithm.
398 Supported diff algorithms are Myers and Patience.
399 This is a global setting which also affects the
400 .Cm diff
401 view.
402 .El
403 .Pp
404 The options for
405 .Cm tog blame
406 are as follows:
407 .Bl -tag -width Ds
408 .It Fl c Ar commit
409 Start traversing history at the specified
410 .Ar commit .
411 The expected argument is the name of a branch or a commit ID SHA1 hash.
412 An abbreviated hash argument will be expanded to a full SHA1 hash
413 automatically, provided the abbreviation is unique.
414 .It Fl r Ar repository-path
415 Use the repository at the specified path.
416 If not specified, assume the repository is located at or above the current
417 working directory.
418 If this directory is a
419 .Xr got 1
420 work tree, use the repository path associated with this work tree.
421 .El
422 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
423 Display the repository tree.
424 If a
425 .Ar path
426 is specified, show tree entries at this path.
427 .Pp
428 Displayed tree entries may carry one of the following trailing annotations:
429 .Bl -column YXZ description
430 .It @ Ta entry is a symbolic link
431 .It / Ta entry is a directory
432 .It * Ta entry is an executable file
433 .It $ Ta entry is a Git submodule
434 .El
435 .Pp
436 Symbolic link entries are also annotated with the target path of the link.
437 .Pp
438 The key bindings for
439 .Cm tog tree
440 are as follows (N denotes optional prefixed count modifier):
441 .Bl -tag -width Ds
442 .It Cm Down-arrow, j, Ctrl-n
443 Move the selection cursor down N lines (default: 1).
444 .It Cm Up-arrow, k, Ctrl-p
445 Move the selection cursor up N lines (default: 1).
446 .It Cm Page-down, Space, Ctrl+f, f
447 Move the selection cursor down N pages (default: 1).
448 .It Cm Page-up, Ctrl+b, b
449 Move the selection cursor up N pages (default: 1).
450 .It Cm Ctrl+d, d
451 Move the selection cursor down N half pages (default: 1).
452 .It Cm Ctrl+u, u
453 Move the selection cursor up N half pages (default: 1).
454 .It Cm Home, g
455 Move the selection cursor to the first entry.
456 .It Cm End, G
457 Move the selection cursor to the last entry.
458 .It Cm Enter
459 Enter the currently selected directory, or switch to the
460 .Cm blame
461 view for the currently selected file.
462 .It Cm l
463 Open a
464 .Cm log
465 view for the currently selected tree entry.
466 .It Cm r
467 Open a
468 .Cm ref
469 view listing all references in the repository.
470 This can then be used to open a new
471 .Cm tree
472 view for arbitrary branches and tags.
473 .It Cm Backspace
474 Move back to the Nth parent directory (default: 1).
475 .It Cm i
476 Show object IDs for all objects displayed in the
477 .Cm tree
478 view.
479 .It Cm /
480 Prompt for a search pattern and start searching for matching tree entries.
481 The search pattern is an extended regular expression which is matched
482 against the tree entry's name.
483 Regular expression syntax is documented in
484 .Xr re_format 7 .
485 .It Cm n
486 Find the Nth next tree entry which matches the current search pattern
487 (default: 1).
488 .It Cm N
489 Find the Nth previous tree entry which matches the current search pattern
490 (default: 1).
491 .El
492 .Pp
493 The options for
494 .Cm tog tree
495 are as follows:
496 .Bl -tag -width Ds
497 .It Fl c Ar commit
498 Start traversing history at the specified
499 .Ar commit .
500 The expected argument is the name of a branch or a commit ID SHA1 hash.
501 An abbreviated hash argument will be expanded to a full SHA1 hash
502 automatically, provided the abbreviation is unique.
503 .It Fl r Ar repository-path
504 Use the repository at the specified path.
505 If not specified, assume the repository is located at or above the current
506 working directory.
507 If this directory is a
508 .Xr got 1
509 work tree, use the repository path associated with this work tree.
510 .El
511 .It Cm ref Oo Fl r Ar repository-path Oc
512 Display references in the repository.
513 .Pp
514 The key bindings for
515 .Cm tog ref
516 are as follows (N denotes optional prefixed count modifier):
517 .Bl -tag -width Ds
518 .It Cm Down-arrow, j, Ctrl-n
519 Move the selection cursor down N lines (default: 1).
520 .It Cm Up-arrow, k, Ctrl-p
521 Move the selection cursor up N lines (default: 1).
522 .It Cm Page-down, Space, Ctrl+f, f
523 Move the selection cursor down N pages (default: 1).
524 .It Cm Page-up, Ctrl+b, b
525 Move the selection cursor up N pages (default: 1).
526 .It Cm Ctrl+d, d
527 Move the selection cursor down N half pages (default: 1).
528 .It Cm Ctrl+u, u
529 Move the selection cursor up N half pages (default: 1).
530 .It Cm Home, g
531 Move the selection cursor to the first reference.
532 .It Cm End, G
533 Move the selection cursor to the last reference.
534 .It Cm Enter
535 Open a
536 .Cm log
537 view which begins traversing history at the commit resolved via the
538 currently selected reference.
539 .It Cm t
540 Open a
541 .Cm tree
542 view showing the tree resolved via the currently selected reference.
543 .It Cm i
544 Show object IDs for all non-symbolic references displayed in the
545 .Cm ref
546 view.
547 .It Cm m
548 Show last modified date of each displayed reference.
549 .It Cm o
550 Toggle display order of references between sort by name and sort by timestamp.
551 .It Cm /
552 Prompt for a search pattern and start searching for matching references.
553 The search pattern is an extended regular expression which is matched
554 against absolute reference names.
555 Regular expression syntax is documented in
556 .Xr re_format 7 .
557 .It Cm n
558 Find the Nth next reference which matches the current search pattern
559 (default: 1).
560 .It Cm N
561 Find the Nth previous reference which matches the current search pattern
562 (default: 1).
563 .It Cm Ctrl+l
564 Reload the list of references displayed by the
565 .Cm ref
566 view.
567 .El
568 .Pp
569 The options for
570 .Cm tog ref
571 are as follows:
572 .Bl -tag -width Ds
573 .It Fl r Ar repository-path
574 Use the repository at the specified path.
575 If not specified, assume the repository is located at or above the current
576 working directory.
577 If this directory is a
578 .Xr got 1
579 work tree, use the repository path associated with this work tree.
580 .El
581 .El
582 .Sh ENVIRONMENT
583 .Bl -tag -width TOG_DIFF_ALGORITHM
584 .It Ev TOG_DIFF_ALGORITHM
585 Determines the default diff algorithm used by
586 .Nm .
587 Valid values are
588 .Dq patience
589 and
590 .Dq myers .
591 If unset, the Myers diff algorithm will be used by default.
592 .It Ev TOG_COLORS
593 .Nm
594 shows colorized output if this variable is set to a non-empty value.
595 The default color scheme can be modified by setting the environment
596 variables documented below.
597 The colors available in color schemes are
598 .Dq black ,
599 .Dq red ,
600 .Dq green ,
601 .Dq yellow ,
602 .Dq blue ,
603 .Dq magenta ,
604 .Dq cyan ,
605 and
606 .Dq default
607 which maps to the terminal's default foreground color.
608 .It Ev TOG_COLOR_DIFF_MINUS
609 The color used to mark up removed lines in diffs.
610 If not set, the default value
611 .Dq magenta
612 is used.
613 .It Ev TOG_COLOR_DIFF_PLUS
614 The color used to mark up added lines in diffs.
615 If not set, the default value
616 .Dq cyan
617 is used.
618 .It Ev TOG_COLOR_DIFF_CHUNK_HEADER
619 The color used to mark up chunk header lines in diffs.
620 If not set, the default value
621 .Dq yellow
622 is used.
623 .It Ev TOG_COLOR_DIFF_META
624 The color used to mark up meta data in diffs.
625 If not set, the default value
626 .Dq green
627 is used.
628 .It Ev TOG_COLOR_TREE_SUBMODULE
629 The color used to mark up submodule tree entries.
630 If not set, the default value
631 .Dq magenta
632 is used.
633 .It Ev TOG_COLOR_TREE_SYMLINK
634 The color used to mark up symbolic link tree entries.
635 If not set, the default value
636 .Dq magenta
637 is used.
638 .It Ev TOG_COLOR_TREE_DIRECTORY
639 The color used to mark up directory tree entries.
640 If not set, the default value
641 .Dq cyan
642 is used.
643 .It Ev TOG_COLOR_TREE_EXECUTABLE
644 The color used to mark up executable file tree entries.
645 If not set, the default value
646 .Dq green
647 is used.
648 .It Ev TOG_COLOR_COMMIT
649 The color used to mark up commit IDs.
650 If not set, the default value
651 .Dq green
652 is used.
653 .It Ev TOG_COLOR_AUTHOR
654 The color used to mark up author information.
655 If not set, the default value
656 .Dq cyan
657 is used.
658 .It Ev TOG_COLOR_DATE
659 The color used to mark up date information.
660 If not set, the default value
661 .Dq yellow
662 is used.
663 .It Ev TOG_COLOR_REFS_HEADS
664 The color used to mark up references in the
665 .Dq refs/heads/
666 namespace.
667 If not set, the default value
668 .Dq green
669 is used.
670 .It Ev TOG_COLOR_REFS_TAGS
671 The color used to mark up references in the
672 .Dq refs/tags/
673 namespace.
674 If not set, the default value
675 .Dq magenta
676 is used.
677 .It Ev TOG_COLOR_REFS_REMOTES
678 The color used to mark up references in the
679 .Dq refs/remotes/
680 namespace.
681 If not set, the default value
682 .Dq yellow
683 is used.
684 .It Ev TOG_COLOR_REFS_BACKUP
685 The color used to mark up references in the
686 .Dq refs/got/backup/
687 namespace.
688 If not set, the default value
689 .Dq cyan
690 is used.
691 .El
692 .Sh EXIT STATUS
693 .Ex -std tog
694 .Sh SEE ALSO
695 .Xr got 1 ,
696 .Xr git-repository 5 ,
697 .Xr re_format 7
698 .Sh AUTHORS
699 .An Stefan Sperling Aq Mt stsp@openbsd.org
700 .An Joshua Stein Aq Mt jcs@openbsd.org