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