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