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