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