Merge with master
[tig] / tig.1.txt
1 TIG(1)
2 ======
3
4 NAME
5 ----
6 tig - text-mode interface for git
7
8 SYNOPSIS
9 --------
10 [verse]
11 tig [options]
12 tig [options] [--] [git log options]
13 tig [options] log [git log options]
14 tig [options] diff [git diff options]
15 tig [options] show [git show options]
16 tig [options] < [git command output]
17
18 DESCRIPTION
19 -----------
20 Browse changes in a git repository. Additionally, tig(1) can also act
21 as a pager for output of various git commands.
22
23 When browsing repositories, tig(1) uses the underlying git commands
24 to present the user with various views, such as summarized commit log
25 and showing the commit with the log message, diffstat, and the diff.
26
27 Using tig(1) as a pager, it will display input from stdin and try
28 to colorize it.
29
30 OPTIONS
31 -------
32
33 -l::
34 Start up in log view using the internal log command.
35
36 -d::
37 Start up in diff view using the internal diff command.
38
39 -n[INTERVAL], --line-number[=INTERVAL]::
40 Prefix line numbers in log and diff view.
41 Optionally, with interval different than each line.
42
43 -t[NSPACES], --tab-size[=NSPACES]::
44 Set the number of spaces tabs should be expanded to.
45
46 -v, --version::
47 Show version and exit.
48
49 \--::
50 End of tig(1) options. Useful when specifying command
51 options for the main view. Example:
52
53 $ tig -- --since=1.month
54
55 log [git log options]::
56 Open log view using the given git log options.
57
58 diff [git diff options]::
59 Open diff view using the given git diff options.
60
61 show [git show options]::
62 Open diff view using the given git show options.
63
64 [git log options]::
65 tig(1) will stop the option parsing when the first
66 command line parameter not starting with "-" is
67 encountered. All options including this one will be
68 passed to git log when loading the main view.
69 This makes it possible to say:
70
71 $ tig tag-1.0..HEAD
72
73 Pager mode
74 ~~~~~~~~~~
75 If stdin is a pipe, any log or diff options will be ignored and the
76 pager view will be opened loading data from stdin. The pager mode
77 can be used for colorizing output from various git commands.
78
79 Example on how to colorize the output of git-show(1):
80
81 $ git show | tig
82
83 Git command options
84 ~~~~~~~~~~~~~~~~~~~
85 All git command options specified on the command line will
86 be passed to the given command and all will be shell quoted
87 before they are passed to the shell.
88
89 NOTE: If you specify options for the main view, you should
90 not use the `--pretty` option as this option will be set
91 automatically to the format expected by the main view.
92
93 Example on how to open the log view and show both author and
94 committer information:
95
96 $ tig log --pretty=fuller
97
98 See the <<refspec, "Specifying revisions">> section below
99 for an introduction to revision options supported by the git
100 commands. For details on specific git command options, refer
101 to the man page of the command in question.
102
103 ENVIRONMENT VARIABLES
104 ---------------------
105 Several options related to the interface with git can be configured
106 via environment options.
107
108 Repository references
109 ~~~~~~~~~~~~~~~~~~~~~
110 Commits that are referenced by tags and branch heads will be marked
111 by the reference name surrounded by '[' and ']':
112
113 2006-03-26 19:42 Petr Baudis | [cogito-0.17.1] Cogito 0.17.1
114
115 If you want to filter out certain directories under `.git/refs/`, say
116 `tmp` you can do it by setting the following variable:
117
118 $ TIG_LS_REMOTE="git ls-remote . | sed /\/tmp\//d" tig
119
120 Or set the variable permanently in your environment.
121
122 TIG_LS_REMOTE::
123 Set command for retrieving all repository references. The command
124 should output data in the same format as git-ls-remote(1).
125
126 [[view-commands]]
127 View commands
128 ~~~~~~~~~~~~~
129 It is possible to alter which commands are used for the different views.
130 If for example you prefer commits in the main view to be sorted by date
131 and only show 500 commits, use:
132
133 $ TIG_MAIN_CMD="git log --date-order -n500 --pretty=raw %s" tig
134
135 Or set the variable permanently in your environment.
136
137 Notice, how `%s` is used to specify the commit reference. There can
138 be a maximum of 5 `%s` ref specifications.
139
140 TIG_DIFF_CMD::
141 The command used for the diff view. By default, git show is used
142 as a backend.
143
144 TIG_LOG_CMD::
145 The command used for the log view. If you prefer to have both
146 author and committer shown in the log view be sure to pass
147 `--pretty=fuller` to git log.
148
149 TIG_MAIN_CMD::
150 The command used for the main view. Note, you must always specify
151 the option: `--pretty=raw` since the main view parser expects to
152 read that format.
153
154 The viewer
155 ----------
156
157 tig(1) presents various 'views' of a repository. Each view is based on output
158 from an external command, most often 'git log', 'git diff', or 'git show'.
159
160 The main view::
161 Is the default view, and it shows a one line summary of each commit
162 in the chosen list of revision. The summary includes commit date,
163 author, and the first line of the log message. Additionally, any
164 repository references, such as tags, will be shown.
165
166 The log view::
167 Presents a more rich view of the revision log showing the whole log
168 message and the diffstat.
169
170 The diff view::
171 Shows either the diff of the current working tree, that is, what
172 has changed since the last commit, or the commit diff complete
173 with log message, diffstat and diff.
174
175 The pager view::
176 Is used for displaying both input from stdin and output from git
177 commands entered in the internal prompt.
178
179 The help view::
180 Displays the information from the tig(1) man page. For the help view
181 to work you need to have the tig(1) man page installed.
182
183 KEYS
184 ----
185 Below the default key bindings are shown.
186
187 View switching
188 ~~~~~~~~~~~~~~
189 m::
190 Switch to main view.
191 d::
192 Switch to diff view.
193 l::
194 Switch to log view.
195 p::
196 Switch to pager view.
197 h::
198 Show man page.
199 Return::
200 If on a commit line show the commit diff. Additionally, if in
201 main or log view this will split the view. To open the commit
202 diff in full size view either use 'd' or press Return twice.
203 Tab::
204 Switch to next view.
205
206 Cursor navigation
207 ~~~~~~~~~~~~~~~~~
208 Up::
209 Move cursor one line up.
210 Down::
211 Move cursor one line down.
212 k::
213 Move cursor one line up and enter. When used in the main view
214 this will always show the diff of the current commit in the
215 split diff view.
216 j::
217 Move cursor one line down and enter.
218 PgUp::
219 Move cursor one page up.
220 PgDown::
221 Move cursor one page down.
222 Home::
223 Jump to first line.
224 End::
225 Jump to last line.
226
227 Scrolling
228 ~~~~~~~~~
229 Insert::
230 Scroll view one line up.
231 Delete::
232 Scroll view one line down.
233 w::
234 Scroll view one page up.
235 s::
236 Scroll view one page down.
237
238 Misc
239 ~~~~
240 q::
241 Quit
242 r::
243 Redraw screen.
244 z::
245 Stop all background loading. This can be useful if you use
246 tig(1) in a repository with a long history without limiting
247 the revision log.
248 v::
249 Show version.
250 n::
251 Toggle line numbers on/off.
252 ':'::
253 Open prompt. This allows you to specify what git command
254 to run. Example:
255
256 :log -p
257
258 [[refspec]]
259 Revision specification
260 ----------------------
261 This section describes various ways to specify what revisions to display
262 or otherwise limit the view to. tig(1) does not itself parse the described
263 revision options so refer to the relevant git man pages for futher
264 information. Relevant man pages besides git-log(1) are git-diff(1) and
265 git-rev-list(1).
266
267 You can tune the interaction with git by making use of the options
268 explained in this section. For example, by configuring the environment
269 variables described in the <<view-commands, "View commands">> section.
270
271 Limit by path name
272 ~~~~~~~~~~~~~~~~~~
273 If you are interested only in those revisions that made changes to a
274 specific file (or even several files) list the files like this:
275
276 $ tig log Makefile
277
278 To avoid ambiguity with repository references such as tag name, be sure
279 to separate file names from other git options using "\--". So if you
280 have a file named 'master' it will clash with the reference named
281 'master', and thus you will have to use:
282
283 $ tig log -- master
284
285 NOTE: For the main view, avoiding ambiguity will in some cases require
286 you to specify two "\--" options. The first will make tig(1) stop
287 option processing and the latter will be passed to git log.
288
289 Limit by date or number
290 ~~~~~~~~~~~~~~~~~~~~~~~
291 To speed up interaction with git, you can limit the amount of commits
292 to show both for the log and main view. Either limit by date using
293 e.g. `--since=1.month` or limit by the number of commits using `-n400`.
294
295 If you are only interested in changed that happened between two dates
296 you can use:
297
298 $ tig -- --after=May.5th --before=2006-05-16.15:44
299
300 NOTE: The dot (".") is used as a separator instead of a space to avoid
301 having to quote the option value. If you prefer use `--after="May 5th"`
302 instead of `--after="May 5th"`.
303
304 Limiting by commit ranges
305 ~~~~~~~~~~~~~~~~~~~~~~~~~
306 Alternatively, commits can be limited to a specific range, such as
307 "all commits between 'tag-1.0' and 'tag-2.0'". For example:
308
309 $ tig log tag-1.0..tag-2.0
310
311 This way of commit limiting makes it trivial to only browse the commits
312 which haven't been pushed to a remote branch. Assuming 'origin' is your
313 upstream remote branch, using:
314
315 $ tig log origin..HEAD
316
317 will list what will be pushed to the remote branch. Optionally, the ending
318 'HEAD' can be left out since it is implied.
319
320 Limiting by reachability
321 ~~~~~~~~~~~~~~~~~~~~~~~~
322 Git interprets the range specifier "tag-1.0..tag-2.0" as
323 "all commits reachable from 'tag-2.0' but not from 'tag-1.0'".
324 Where reachability refers to what commits are ancestors (or part of the
325 history) of the branch or tagged revision in question.
326
327 If you prefer to specify which commit to preview in this way use the
328 following:
329
330 $ tig log tag-2.0 ^tag-1.0
331
332 You can think of '^' as a negation operator. Using this alternate syntax,
333 it is possible to further prune commits by specifying multiple branch
334 cut offs.
335
336 Combining revisions specification
337 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
338 Revisions options can to some degree be combined, which makes it possible
339 to say "show at most 20 commits from within the last month that changed
340 files under the Documentation/ directory."
341
342 $ tig -- --since=1.month -n20 -- Documentation/
343
344 Examining all repository references
345 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346 In some cases, it can be useful to query changes across all references
347 in a repository. An example is to ask "did any line of development in
348 this repository change a particular file within the last week". This
349 can be accomplished using:
350
351 $ tig -- --all --since=1.week -- Makefile
352
353 BUGS
354 ----
355 Known bugs and problems:
356
357 - If the screen width is very small the main view can draw
358 outside the current view causing bad wrapping. Same goes
359 for title and status windows.
360
361 TODO
362 ----
363 Features that should be explored.
364
365 - Searching.
366
367 - Locale support.
368
369 COPYRIGHT
370 ---------
371 Copyright (c) Jonas Fonseca <fonseca@diku.dk>, 2006
372
373 This program is free software; you can redistribute it and/or modify
374 it under the terms of the GNU General Public License as published by
375 the Free Software Foundation; either version 2 of the License, or
376 (at your option) any later version.
377
378 SEE ALSO
379 --------
380 [verse]
381 link:http://www.kernel.org/pub/software/scm/git/docs/[git(7)],
382 link:http://www.kernel.org/pub/software/scm/cogito/docs/[cogito(7)]
383 gitk(1): git repository browser written using tcl/tk,
384 gitview(1): git repository browser written using python/gtk.
385