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