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