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 Specifying revisions
260 --------------------
261 This section describes various ways to specify what revisions to display
262 or otherwise limit the view to. Note, that tig(1) does not itself parse
263 the described revision options.
264
265 File history
266 ~~~~~~~~~~~~
267 If you are interested only in those revisions that made changes to a
268 specific file (or even several files) list the files like this:
269
270 $ tig log Makefile
271
272 To avoid ambiguity with repository references such as tag name, be sure
273 to separate file names from other git options using "\--". So if you
274 have a file named 'master' it will clash with the reference named
275 'master', and thus you will have to use:
276
277 $ tag log -- master
278
279 NOTE: For the main view, avoiding ambiguity will in some cases require
280 you to specify two "\--" options. The first will make tig(1) stop
281 option processing and the latter will be passed to git log.
282
283 Limit by date or number
284 ~~~~~~~~~~~~~~~~~~~~~~~
285 To speed up interaction with git, you can limit the amount of commits
286 to show both for the log and main view. Either limit by date using
287 e.g. `--since=1.month` or limit by the number of commits using `-n400`.
288
289 NOTE: You can tune the interaction with git by making use of the options
290 explained in this section. For example, by configuring the environment
291 variables described in the <<view-commands, "View commands">> section.
292
293 Ranges
294 ~~~~~~
295 Alternatively, commits can be limited to a specific range, such as
296 "all commits between 'tag-1.0' and 'tag-2.0'". For example:
297
298 $ tig log tag-1.0..tag-2.0
299
300 This way of commit limiting makes it trivial to only browse the commits
301 which haven't been pushed to a remote branch. Assuming 'origin' is your
302 upstream remote branch, using:
303
304 $ tig log origin..HEAD
305
306 will list what will be pushed to the remote branch. Optionally, the ending
307 'HEAD' can be left out since it is implied.
308
309 Limiting by reachability
310 ~~~~~~~~~~~~~~~~~~~~~~~~
311 Git interprets the range specifier "tag-1.0..tag-2.0" as
312 "all commits reachable from 'tag-2.0' but not from 'tag-1.0'".
313 If you prefer to specify which commit to preview in this way use the
314 following:
315
316 $ tig log tag-2.0 ^tag-1.0
317
318 You can think of '^' as a negation operator. Using this alternate syntax,
319 it is possible to further prune commits by specifying multiple branch
320 cut offs.
321
322 BUGS
323 ----
324 Known bugs and problems:
325
326 - If the screen width is very small the main view can draw
327 outside the current view causing bad wrapping. Same goes
328 for title and status windows.
329
330 TODO
331 ----
332 Features that should be explored.
333
334 - Searching.
335
336 - Locale support.
337
338 COPYRIGHT
339 ---------
340 Copyright (c) Jonas Fonseca <fonseca@diku.dk>, 2006
341
342 This program is free software; you can redistribute it and/or modify
343 it under the terms of the GNU General Public License as published by
344 the Free Software Foundation; either version 2 of the License, or
345 (at your option) any later version.
346
347 SEE ALSO
348 --------
349 [verse]
350 link:http://www.kernel.org/pub/software/scm/git/docs/[git(7)],
351 link:http://www.kernel.org/pub/software/scm/cogito/docs/[cogito(7)]
352 gitk(1): git repository browser written using tcl/tk,
353 gitview(1): git repository browser written using python/gtk.
354