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