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