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 r Ar repository-path Oc Ar object1 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 Backspace
350 Move back to the parent directory.
351 .It Cm i
352 Show object IDs for all objects displayed in the
353 .Cm tree
354 view.
355 .It Cm /
356 Prompt for a search pattern and start searching for matching tree entries.
357 The search pattern is an extended regular expression which is matched
358 against the tree entry's name.
359 Regular expression syntax is documented in
360 .Xr re_format 7 .
361 .It Cm n
362 Find the next tree entry which matches the current search pattern.
363 .It Cm N
364 Find the previous tree entry which matches the current search pattern.
365 .El
366 .Pp
367 The options for
368 .Cm tog tree
369 are as follows:
370 .Bl -tag -width Ds
371 .It Fl c Ar commit
372 Start traversing history at the specified
373 .Ar commit .
374 The expected argument is the name of a branch or a commit ID SHA1 hash.
375 An abbreviated hash argument will be expanded to a full SHA1 hash
376 automatically, provided the abbreviation is unique.
377 .It Fl r Ar repository-path
378 Use the repository at the specified path.
379 If not specified, assume the repository is located at or above the current
380 working directory.
381 If this directory is a
382 .Xr got 1
383 work tree, use the repository path associated with this work tree.
384 .El
385 .It Cm ref Oo Fl r Ar repository-path Oc
386 Display references in the repository.
387 .Pp
388 The key bindings for
389 .Cm tog ref
390 are as follows:
391 .Bl -tag -width Ds
392 .It Cm Down-arrow, j
393 Move the selection cursor down.
394 .It Cm Up-arrow, k
395 Move the selection cursor up.
396 .It Cm Page-down, Ctrl+f
397 Move the selection cursor down one page.
398 .It Cm Page-up, Ctrl+b
399 Move the selection cursor up one page.
400 .It Cm Enter
401 Open a log view which begins traversing history at the commit resolved via the
402 currently selected reference.
403 .It Cm t
404 Open a
405 .Cm tree
406 view showing the tree resolved via the currently selected reference.
407 .It Cm i
408 Show object IDs for all non-symbolic references displayed in the
409 .Cm ref
410 view.
411 .It Cm /
412 Prompt for a search pattern and start searching for matching references.
413 The search pattern is an extended regular expression which is matched
414 against absolute reference names.
415 Regular expression syntax is documented in
416 .Xr re_format 7 .
417 .It Cm n
418 Find the next reference which matches the current search pattern.
419 .It Cm N
420 Find the previous reference which matches the current search pattern.
421 .It Cm Ctrl+l
422 Reload the list of references displayed by the
423 .Cm ref
424 view.
425 .El
426 .Pp
427 The options for
428 .Cm tog ref
429 are as follows:
430 .Bl -tag -width Ds
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 .El
440 .Sh ENVIRONMENT
441 .Bl -tag -width TOG_COLORS
442 .It Ev TOG_COLORS
443 .Nm
444 shows colorized output if this variable is set to a non-empty value.
445 The default color scheme can be modified by setting the environment
446 variables documented below.
447 The colors available in color schemes are
448 .Dq black ,
449 .Dq red ,
450 .Dq green ,
451 .Dq yellow ,
452 .Dq blue ,
453 .Dq megenta ,
454 .Dq cyan ,
455 and
456 .Dq default
457 which maps to the terminal's default foreground color.
458 .It Ev TOG_COLOR_DIFF_MINUS
459 The color used to mark up removed lines in diffs.
460 If not set, the default value
461 .Dq magenta
462 is used.
463 .It Ev TOG_COLOR_DIFF_PLUS
464 The color used to mark up added lines in diffs.
465 If not set, the default value
466 .Dq cyan
467 is used.
468 .It Ev TOG_COLOR_DIFF_CHUNK_HEADER
469 The color used to mark up chunk header lines in diffs.
470 If not set, the default value
471 .Dq yellow
472 is used.
473 .It Ev TOG_COLOR_DIFF_META
474 The color used to mark up meta data in diffs.
475 If not set, the default value
476 .Dq green
477 is used.
478 .It Ev TOG_COLOR_TREE_SUBMODULE
479 The color used to mark up sobmodules tree entries.
480 If not set, the default value
481 .Dq magenta
482 is used.
483 .It Ev TOG_COLOR_TREE_SYMLINK
484 The color used to mark up symbolic link tree entries.
485 If not set, the default value
486 .Dq magenta
487 is used.
488 .It Ev TOG_COLOR_TREE_DIRECTORY
489 The color used to mark up directory tree entries.
490 If not set, the default value
491 .Dq cyan
492 is used.
493 .It Ev TOG_COLOR_TREE_EXECUTABLE
494 The color used to mark up executable file tree entries.
495 If not set, the default value
496 .Dq green
497 is used.
498 .It Ev TOG_COLOR_COMMIT
499 The color used to mark up commit IDs.
500 If not set, the default value
501 .Dq green
502 is used.
503 .It Ev TOG_COLOR_AUTHOR
504 The color used to mark up author information.
505 If not set, the default value
506 .Dq cyan
507 is used.
508 .It Ev TOG_COLOR_DATE
509 The color used to mark up date information.
510 If not set, the default value
511 .Dq yellow
512 is used.
513 .It Ev TOG_COLOR_REFS_HEADS
514 The color used to mark up references in the
515 .Dq refs/heads/
516 namespace.
517 If not set, the default value
518 .Dq green
519 is used.
520 .It Ev TOG_COLOR_REFS_TAGS
521 The color used to mark up references in the
522 .Dq refs/tags/
523 namespace.
524 If not set, the default value
525 .Dq magenta
526 is used.
527 .It Ev TOG_COLOR_REFS_REMOTES
528 The color used to mark up references in the
529 .Dq refs/remotes/
530 namespace.
531 If not set, the default value
532 .Dq yellow
533 is used.
534 .El
535 .Sh EXIT STATUS
536 .Ex -std tog
537 .Sh SEE ALSO
538 .Xr got 1 ,
539 .Xr git-repository 5 ,
540 .Xr re_format 7
541 .Sh AUTHORS
542 .An Stefan Sperling Aq Mt stsp@openbsd.org
543 .An Joshua Stein Aq Mt jcs@openbsd.org