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