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