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