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