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