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 Each
181 .Ar object
182 argument is an object ID SHA1 hash.
183 An abbreviated hash argument will be expanded to a full SHA1 hash
184 automatically, provided the abbreviation is unique.
185 Both objects must be of the same type (blobs, trees, or commits).
186 .Pp
187 The key bindings for
188 .Cm tog diff
189 are as follows:
190 .Bl -tag -width Ds
191 .It Cm a
192 Toggle treatment of file contents as ASCII text even if binary data was
193 detected.
194 .It Cm Down-arrow, j
195 Scroll down.
196 .It Cm Up-arrow, k
197 Scroll up.
198 .It Cm Page-down, Space, Ctrl+f
199 Scroll down one page.
200 .It Cm Page-up, Ctrl+b
201 Scroll up one page.
202 .It Cm \&[
203 Reduce the amount of diff context lines.
204 .It Cm \&]
205 Increase the amount of diff context lines.
206 .It Cm <, Comma
207 If the diff view was opened via the log view, move to the previous (younger)
208 commit.
209 .It Cm >, Full stop
210 If the diff view was opened via the log view, move to the next (older) commit.
211 .It Cm /
212 Prompt for a search pattern and start searching for matching lines.
213 The search pattern is an extended regular expression.
214 Regular expression syntax is documented in
215 .Xr re_format 7 .
216 .It Cm n
217 Find the next line which matches the current search pattern.
218 .It Cm N
219 Find the previous line which matches the current search pattern.
220 .El
221 .Pp
222 The options for
223 .Cm tog diff
224 are as follows:
225 .Bl -tag -width Ds
226 .It Fl a
227 Treat file contents as ASCII text even if binary data is detected.
228 .It Fl r Ar repository-path
229 Use the repository at the specified path.
230 If not specified, assume the repository is located at or above the current
231 working directory.
232 If this directory is a
233 .Xr got 1
234 work tree, use the repository path associated with this work tree.
235 .El
236 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
237 Display line-by-line history of a file at the specified path.
238 .Pp
239 The key bindings for
240 .Cm tog blame
241 are as follows:
242 .Bl -tag -width Ds
243 .It Cm Down-arrow, j
244 Move the selection cursor down.
245 .It Cm Up-arrow, k
246 Move the selection cursor up.
247 .It Cm Page-down, Space, Ctrl+f
248 Move the selection cursor down one page.
249 .It Cm Page-up, Ctrl+b
250 Move the selection cursor up one page.
251 .It Cm Enter
252 Open a
253 .Cm diff
254 view for the currently selected line's commit.
255 .It Cm b
256 Reload the
257 .Cm blame
258 view with the version of the file as found in the currently
259 selected line's commit.
260 .It Cm p
261 Reload the
262 .Cm blame
263 view with the version of the file as found in the parent commit of the
264 currently selected line's commit.
265 .It Cm B
266 Reload the
267 .Cm blame
268 view with the previously blamed commit.
269 .It Cm /
270 Prompt for a search pattern and start searching for matching lines.
271 The search pattern is an extended regular expression.
272 Regular expression syntax is documented in
273 .Xr re_format 7 .
274 .It Cm n
275 Find the next line which matches the current search pattern.
276 .It Cm N
277 Find the previous line which matches the current search pattern.
278 .El
279 .Pp
280 The options for
281 .Cm tog blame
282 are as follows:
283 .Bl -tag -width Ds
284 .It Fl c Ar commit
285 Start traversing history at the specified
286 .Ar commit .
287 The expected argument is the name of a branch or a commit ID SHA1 hash.
288 An abbreviated hash argument will be expanded to a full SHA1 hash
289 automatically, provided the abbreviation is unique.
290 .It Fl r Ar repository-path
291 Use the repository at the specified path.
292 If not specified, assume the repository is located at or above the current
293 working directory.
294 If this directory is a
295 .Xr got 1
296 work tree, use the repository path associated with this work tree.
297 .El
298 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
299 Display the repository tree.
300 If a
301 .Ar path
302 is specified, show tree entries at this path.
303 .Pp
304 Displayed tree entries may carry one of the following trailing annotations:
305 .Bl -column YXZ description
306 .It @ Ta entry is a symbolic link
307 .It / Ta entry is a directory
308 .It * Ta entry is an executable file
309 .It $ Ta entry is a Git submodule
310 .El
311 .Pp
312 Symbolic link entries are also annotated with the target path of the link.
313 .Pp
314 The key bindings for
315 .Cm tog tree
316 are as follows:
317 .Bl -tag -width Ds
318 .It Cm Down-arrow, j
319 Move the selection cursor down.
320 .It Cm Up-arrow, k
321 Move the selection cursor up.
322 .It Cm Page-down, Ctrl+f
323 Move the selection cursor down one page.
324 .It Cm Page-up, Ctrl+b
325 Move the selection cursor up one page.
326 .It Cm Enter
327 Enter the currently selected directory, or switch to the
328 .Cm blame
329 view for the currently selected file.
330 .It Cm l
331 Open a
332 .Cm log
333 view for the currently selected tree entry.
334 .It Cm Backspace
335 Move back to the parent directory.
336 .It Cm i
337 Show object IDs for all objects displayed in the
338 .Cm tree
339 view.
340 .It Cm /
341 Prompt for a search pattern and start searching for matching tree entries.
342 The search pattern is an extended regular expression which is matched
343 against the tree entry's name.
344 Regular expression syntax is documented in
345 .Xr re_format 7 .
346 .It Cm n
347 Find the next tree entry which matches the current search pattern.
348 .It Cm N
349 Find the previous tree entry which matches the current search pattern.
350 .El
351 .Pp
352 The options for
353 .Cm tog tree
354 are as follows:
355 .Bl -tag -width Ds
356 .It Fl c Ar commit
357 Start traversing history at the specified
358 .Ar commit .
359 The expected argument is the name of a branch or a commit ID SHA1 hash.
360 An abbreviated hash argument will be expanded to a full SHA1 hash
361 automatically, provided the abbreviation is unique.
362 .It Fl r Ar repository-path
363 Use the repository at the specified path.
364 If not specified, assume the repository is located at or above the current
365 working directory.
366 If this directory is a
367 .Xr got 1
368 work tree, use the repository path associated with this work tree.
369 .El
370 .El
371 .Sh ENVIRONMENT
372 .Bl -tag -width TOG_COLORS
373 .It Ev TOG_COLORS
374 .Nm
375 shows colorized output if this variable is set to a non-empty value.
376 The default color scheme can be modified by setting the environment
377 variables documented below.
378 The colors available in color schemes are
379 .Dq black ,
380 .Dq red ,
381 .Dq green ,
382 .Dq yellow ,
383 .Dq blue ,
384 .Dq megenta ,
385 .Dq cyan ,
386 and
387 .Dq default
388 which maps to the terminal's default foreground color.
389 .It Ev TOG_COLOR_DIFF_MINUS
390 The color used to mark up removed lines in diffs.
391 If not set, the default value
392 .Dq magenta
393 is used.
394 .It Ev TOG_COLOR_DIFF_PLUS
395 The color used to mark up added lines in diffs.
396 If not set, the default value
397 .Dq cyan
398 is used.
399 .It Ev TOG_COLOR_DIFF_CHUNK_HEADER
400 The color used to mark up chunk header lines in diffs.
401 If not set, the default value
402 .Dq yellow
403 is used.
404 .It Ev TOG_COLOR_DIFF_META
405 The color used to mark up meta data in diffs.
406 If not set, the default value
407 .Dq green
408 is used.
409 .It Ev TOG_COLOR_TREE_SUBMODULE
410 The color used to mark up sobmodules tree entries.
411 If not set, the default value
412 .Dq magenta
413 is used.
414 .It Ev TOG_COLOR_TREE_SYMLINK
415 The color used to mark up symbolic link tree entries.
416 If not set, the default value
417 .Dq magenta
418 is used.
419 .It Ev TOG_COLOR_TREE_DIRECTORY
420 The color used to mark up directory tree entries.
421 If not set, the default value
422 .Dq cyan
423 is used.
424 .It Ev TOG_COLOR_TREE_EXECUTABLE
425 The color used to mark up executable file tree entries.
426 If not set, the default value
427 .Dq green
428 is used.
429 .It Ev TOG_COLOR_COMMIT
430 The color used to mark up commit IDs.
431 If not set, the default value
432 .Dq green
433 is used.
434 .It Ev TOG_COLOR_AUTHOR
435 The color used to mark up author information.
436 If not set, the default value
437 .Dq cyan
438 is used.
439 .It Ev TOG_COLOR_DATE
440 The color used to mark up date information.
441 If not set, the default value
442 .Dq yellow
443 is used.
444 .El
445 .Sh EXIT STATUS
446 .Ex -std tog
447 .Sh SEE ALSO
448 .Xr got 1 ,
449 .Xr git-repository 5 ,
450 .Xr re_format 7
451 .Sh AUTHORS
452 .An Stefan Sperling Aq Mt stsp@openbsd.org
453 .An Joshua Stein Aq Mt jcs@openbsd.org