Create documentation branch
[tig] / tig.1.txt
CommitLineData
2b9c2ad0
JF
1TIG(1)
2======
3
4NAME
5----
6tig - text-mode interface for git
7
8SYNOPSIS
9--------
10[verse]
11tig [options]
12tig [options] [--] [git log options]
13tig [options] log [git log options]
14tig [options] diff [git diff options]
15tig [options] show [git show options]
16tig [options] < [git command output]
17
18DESCRIPTION
19-----------
20Browse changes in a git repository. Additionally, tig(1) can also act
21as a pager for output of various git commands.
22
23When browsing repositories, tig(1) uses the underlying git commands
24to present the user with various views, such as summarized commit log
25and showing the commit with the log message, diffstat, and the diff.
26
27Using tig(1) as a pager, it will display input from stdin and try
28to colorize it.
29
30OPTIONS
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
55log [git log options]::
56 Open log view using the given git log options.
57
58diff [git diff options]::
59 Open diff view using the given git diff options.
60
61show [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
73Pager mode
74~~~~~~~~~~
75If stdin is a pipe, any log or diff options will be ignored and the
76pager view will be opened loading data from stdin. The pager mode
77can be used for colorizing output from various git commands.
78
79Example on how to colorize the output of git-show(1):
80
81 $ git show | tig
82
83Git command options
84~~~~~~~~~~~~~~~~~~~
85All git command options specified on the command line will
86be passed to the given command and all will be shell quoted
87before they are passed to the shell.
88
89NOTE: If you specify options for the main view, you should
90not use the `--pretty` option as this option will be set
91automatically to the format expected by the main view.
92
93Example on how to open the log view and show both author and
94committer information:
95
96 $ tig log --pretty=fuller
97
98See the <<refspec, "Specifying revisions">> section below
99for an introduction to revision options supported by the git
100commands. For details on specific git command options, refer
101to the man page of the command in question.
102
103ENVIRONMENT VARIABLES
104---------------------
105Several options related to the interface with git can be configured
106via environment options.
107
108Repository references
109~~~~~~~~~~~~~~~~~~~~~
110Commits that are referenced by tags and branch heads will be marked
111by the reference name surrounded by '[' and ']':
112
113 2006-03-26 19:42 Petr Baudis | [cogito-0.17.1] Cogito 0.17.1
114
115If 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
120Or set the variable permanently in your environment.
121
122TIG_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]]
127View commands
128~~~~~~~~~~~~~
129It is possible to alter which commands are used for the different views.
130If for example you prefer commits in the main view to be sorted by date
131and only show 500 commits, use:
132
133 $ TIG_MAIN_CMD="git log --date-order -n500 --pretty=raw %s" tig
134
135Or set the variable permanently in your environment.
136
137Notice, how `%s` is used to specify the commit reference. There can
138be a maximum of 5 `%s` ref specifications.
139
140TIG_DIFF_CMD::
141 The command used for the diff view. By default, git show is used
142 as a backend.
143
144TIG_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
149TIG_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
154The viewer
155----------
156
157tig(1) presents various 'views' of a repository. Each view is based on output
158from an external command, most often 'git log', 'git diff', or 'git show'.
159
160The 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
166The log view::
167 Presents a more rich view of the revision log showing the whole log
168 message and the diffstat.
169
170The 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
175The pager view::
176 Is used for displaying both input from stdin and output from git
177 commands entered in the internal prompt.
178
179The 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
183KEYS
184----
185Below the default key bindings are shown.
186
187View switching
188~~~~~~~~~~~~~~
189m::
190 Switch to main view.
191d::
192 Switch to diff view.
193l::
194 Switch to log view.
195p::
196 Switch to pager view.
197h::
198 Show man page.
199Return::
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.
203Tab::
204 Switch to next view.
205
206Cursor navigation
207~~~~~~~~~~~~~~~~~
208Up::
209 Move cursor one line up.
210Down::
211 Move cursor one line down.
212k::
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.
216j::
217 Move cursor one line down and enter.
218PgUp::
219 Move cursor one page up.
220PgDown::
221 Move cursor one page down.
222Home::
223 Jump to first line.
224End::
225 Jump to last line.
226
227Scrolling
228~~~~~~~~~
229Insert::
230 Scroll view one line up.
231Delete::
232 Scroll view one line down.
233w::
234 Scroll view one page up.
235s::
236 Scroll view one page down.
237
238Misc
239~~~~
240q::
241 Quit
242r::
243 Redraw screen.
244z::
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.
248v::
249 Show version.
250n::
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]]
259Specifying revisions
260--------------------
261This section describes various ways to specify what revisions to display
262or otherwise limit the view to. Note, that tig(1) does not itself parse
263the described revision options.
264
265File history
266------------
267If you are interested only in those revisions that made changes to a
268specific file (or even several files) list the files like this:
269
270 $ tig log Makefile
271
272To avoid ambiguity with repository references such as tag name, be sure
273to separate file names from other git options using "\--". So if you
274have 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
279NOTE: For the main view, avoiding ambiguity will in some cases require
280you to specify two "\--" options. The first will make tig(1) stop
281option processing and the latter will be passed to git log.
282
283Limit by date or number
284~~~~~~~~~~~~~~~~~~~~~~~
285To speed up interaction with git, you can limit the amount of commits
286to show both for the log and main view. Either limit by date using
287e.g. `--since=1.month` or limit by the number of commits using `-n400`.
288
289NOTE: You can tune the interaction with git by making use of the options
290explained in this section. For example, by configuring the environment
291variables described in the <<view-commands, "View commands">> section.
292
293Ranges
294~~~~~~
295Alternatively, 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
300This way of commit limiting makes it trivial to only browse the commits
301which haven't been pushed to a remote branch. Assuming 'origin' is your
302upstream remote branch, using:
303
304 $ tig log origin..HEAD
305
306will list what will be pushed to the remote branch. Optionally, the ending
307'HEAD' can be left out since it is implied.
308
309Limiting by reachability
310~~~~~~~~~~~~~~~~~~~~~~~~
311Git 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'".
313If you prefer to specify which commit to preview in this way use the
314following:
315
316 $ tig log tag-2.0 ^tag-1.0
317
318You can think of '^' as a negation operator. Using this alternate syntax,
319it is possible to further prune commits by specifying multiple branch
320cut offs.
321
322BUGS
323----
324Known bugs and problems:
325
326- If the screen width is very small the main view can draw
327outside the current view causing bad wrapping. Same goes
328for title and status windows.
329
330TODO
331----
332Features that should be explored.
333
334- Searching.
335
336- Locale support.
337
338COPYRIGHT
339---------
340Copyright (c) Jonas Fonseca <fonseca@diku.dk>, 2006
341
342This program is free software; you can redistribute it and/or modify
343it under the terms of the GNU General Public License as published by
344the Free Software Foundation; either version 2 of the License, or
345(at your option) any later version.
346
347SEE ALSO
348--------
349[verse]
350link:http://www.kernel.org/pub/software/scm/git/docs/[git(7)],
351link:http://www.kernel.org/pub/software/scm/cogito/docs/[cogito(7)]
352gitk(1): git repository browser written using tcl/tk,
353gitview(1): git repository browser written using python/gtk.
354