Document how to tell git to not launch a pager
[git/jnareb-git.git] / Documentation / git.txt
blob4c4d1746e03bdf47959ba58335785974d20efdee
1 git(7)
2 ======
4 NAME
5 ----
6 git - the stupid content tracker
9 SYNOPSIS
10 --------
11 [verse]
12 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
13     [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
14     [--help] COMMAND [ARGS]
16 DESCRIPTION
17 -----------
18 Git is a fast, scalable, distributed revision control system with an
19 unusually rich command set that provides both high-level operations
20 and full access to internals.
22 See this link:tutorial.html[tutorial] to get started, then see
23 link:everyday.html[Everyday Git] for a useful minimum set of commands, and
24 "man git-commandname" for documentation of each command.  CVS users may
25 also want to read link:cvs-migration.html[CVS migration].  See
26 link:user-manual.html[Git User's Manual] for a more in-depth
27 introduction.
29 The COMMAND is either a name of a Git command (see below) or an alias
30 as defined in the configuration file (see gitlink:git-config[1]).
32 Formatted and hyperlinked version of the latest git
33 documentation can be viewed at
34 `http://www.kernel.org/pub/software/scm/git/docs/`.
36 ifdef::stalenotes[]
37 [NOTE]
38 ============
40 You are reading the documentation for the latest (possibly
41 unreleased) version of git, that is available from 'master'
42 branch of the `git.git` repository.
43 Documentation for older releases are available here:
45 * link:v1.5.2.4/git.html[documentation for release 1.5.2.4]
47 * release notes for
48   link:RelNotes-1.5.2.4.txt[1.5.2.4],
49   link:RelNotes-1.5.2.3.txt[1.5.2.3],
50   link:RelNotes-1.5.2.2.txt[1.5.2.2],
51   link:RelNotes-1.5.2.1.txt[1.5.2.1],
52   link:RelNotes-1.5.2.txt[1.5.2].
54 * link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
56 * release notes for
57   link:RelNotes-1.5.1.6.txt[1.5.1.6],
58   link:RelNotes-1.5.1.5.txt[1.5.1.5],
59   link:RelNotes-1.5.1.4.txt[1.5.1.4],
60   link:RelNotes-1.5.1.3.txt[1.5.1.3],
61   link:RelNotes-1.5.1.2.txt[1.5.1.2],
62   link:RelNotes-1.5.1.1.txt[1.5.1.1],
63   link:RelNotes-1.5.1.txt[1.5.1].
65 * link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
67 * release notes for
68   link:RelNotes-1.5.0.7.txt[1.5.0.7],
69   link:RelNotes-1.5.0.6.txt[1.5.0.6],
70   link:RelNotes-1.5.0.5.txt[1.5.0.5],
71   link:RelNotes-1.5.0.3.txt[1.5.0.3],
72   link:RelNotes-1.5.0.2.txt[1.5.0.2],
73   link:RelNotes-1.5.0.1.txt[1.5.0.1],
74   link:RelNotes-1.5.0.txt[1.5.0].
76 * documentation for release link:v1.4.4.4/git.html[1.4.4.4],
77   link:v1.3.3/git.html[1.3.3],
78   link:v1.2.6/git.html[1.2.6],
79   link:v1.0.13/git.html[1.0.13].
81 ============
83 endif::stalenotes[]
85 OPTIONS
86 -------
87 --version::
88         Prints the git suite version that the 'git' program came from.
90 --help::
91         Prints the synopsis and a list of the most commonly used
92         commands.  If a git command is named this option will bring up
93         the man-page for that command. If the option '--all' or '-a' is
94         given then all available commands are printed.
96 --exec-path::
97         Path to wherever your core git programs are installed.
98         This can also be controlled by setting the GIT_EXEC_PATH
99         environment variable. If no path is given 'git' will print
100         the current setting and then exit.
102 -p|--paginate::
103         Pipe all output into 'less' (or if set, $PAGER).
105 --git-dir=<path>::
106         Set the path to the repository. This can also be controlled by
107         setting the GIT_DIR environment variable.
109 --work-tree=<path>::
110         Set the path to the working tree.  The value will not be
111         used in combination with repositories found automatically in
112         a .git directory (i.e. $GIT_DIR is not set).
113         This can also be controlled by setting the GIT_WORK_TREE
114         environment variable and the core.worktree configuration
115         variable.
117 --bare::
118         Same as --git-dir=`pwd`.
120 FURTHER DOCUMENTATION
121 ---------------------
123 See the references above to get started using git.  The following is
124 probably more detail than necessary for a first-time user.
126 The <<Discussion,Discussion>> section below and the
127 link:core-tutorial.html[Core tutorial] both provide introductions to the
128 underlying git architecture.
130 See also the link:howto-index.html[howto] documents for some useful
131 examples.
133 GIT COMMANDS
134 ------------
136 We divide git into high level ("porcelain") commands and low level
137 ("plumbing") commands.
139 High-level commands (porcelain)
140 -------------------------------
142 We separate the porcelain commands into the main commands and some
143 ancillary user utilities.
145 Main porcelain commands
146 ~~~~~~~~~~~~~~~~~~~~~~~
148 include::cmds-mainporcelain.txt[]
150 Ancillary Commands
151 ~~~~~~~~~~~~~~~~~~
152 Manipulators:
154 include::cmds-ancillarymanipulators.txt[]
156 Interrogators:
158 include::cmds-ancillaryinterrogators.txt[]
161 Interacting with Others
162 ~~~~~~~~~~~~~~~~~~~~~~~
164 These commands are to interact with foreign SCM and with other
165 people via patch over e-mail.
167 include::cmds-foreignscminterface.txt[]
170 Low-level commands (plumbing)
171 -----------------------------
173 Although git includes its
174 own porcelain layer, its low-level commands are sufficient to support
175 development of alternative porcelains.  Developers of such porcelains
176 might start by reading about gitlink:git-update-index[1] and
177 gitlink:git-read-tree[1].
179 The interface (input, output, set of options and the semantics)
180 to these low-level commands are meant to be a lot more stable
181 than Porcelain level commands, because these commands are
182 primarily for scripted use.  The interface to Porcelain commands
183 on the other hand are subject to change in order to improve the
184 end user experience.
186 The following description divides
187 the low-level commands into commands that manipulate objects (in
188 the repository, index, and working tree), commands that interrogate and
189 compare objects, and commands that move objects and references between
190 repositories.
193 Manipulation commands
194 ~~~~~~~~~~~~~~~~~~~~~
196 include::cmds-plumbingmanipulators.txt[]
199 Interrogation commands
200 ~~~~~~~~~~~~~~~~~~~~~~
202 include::cmds-plumbinginterrogators.txt[]
204 In general, the interrogate commands do not touch the files in
205 the working tree.
208 Synching repositories
209 ~~~~~~~~~~~~~~~~~~~~~
211 include::cmds-synchingrepositories.txt[]
213 The following are helper programs used by the above; end users
214 typically do not use them directly.
216 include::cmds-synchelpers.txt[]
219 Internal helper commands
220 ~~~~~~~~~~~~~~~~~~~~~~~~
222 These are internal helper commands used by other commands; end
223 users typically do not use them directly.
225 include::cmds-purehelpers.txt[]
228 Configuration Mechanism
229 -----------------------
231 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
232 is used to hold per-repository configuration options.  It is a
233 simple text file modeled after `.ini` format familiar to some
234 people.  Here is an example:
236 ------------
238 # A '#' or ';' character indicates a comment.
241 ; core variables
242 [core]
243         ; Don't trust file modes
244         filemode = false
246 ; user identity
247 [user]
248         name = "Junio C Hamano"
249         email = "junkio@twinsun.com"
251 ------------
253 Various commands read from the configuration file and adjust
254 their operation accordingly.
257 Identifier Terminology
258 ----------------------
259 <object>::
260         Indicates the object name for any type of object.
262 <blob>::
263         Indicates a blob object name.
265 <tree>::
266         Indicates a tree object name.
268 <commit>::
269         Indicates a commit object name.
271 <tree-ish>::
272         Indicates a tree, commit or tag object name.  A
273         command that takes a <tree-ish> argument ultimately wants to
274         operate on a <tree> object but automatically dereferences
275         <commit> and <tag> objects that point at a <tree>.
277 <commit-ish>::
278         Indicates a commit or tag object name.  A
279         command that takes a <commit-ish> argument ultimately wants to
280         operate on a <commit> object but automatically dereferences
281         <tag> objects that point at a <commit>.
283 <type>::
284         Indicates that an object type is required.
285         Currently one of: `blob`, `tree`, `commit`, or `tag`.
287 <file>::
288         Indicates a filename - almost always relative to the
289         root of the tree structure `GIT_INDEX_FILE` describes.
291 Symbolic Identifiers
292 --------------------
293 Any git command accepting any <object> can also use the following
294 symbolic notation:
296 HEAD::
297         indicates the head of the current branch (i.e. the
298         contents of `$GIT_DIR/HEAD`).
300 <tag>::
301         a valid tag 'name'
302         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
304 <head>::
305         a valid head 'name'
306         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
308 For a more complete list of ways to spell object names, see
309 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
312 File/Directory Structure
313 ------------------------
315 Please see link:repository-layout.html[repository layout] document.
317 Read link:hooks.html[hooks] for more details about each hook.
319 Higher level SCMs may provide and manage additional information in the
320 `$GIT_DIR`.
323 Terminology
324 -----------
325 Please see link:glossary.html[glossary] document.
328 Environment Variables
329 ---------------------
330 Various git commands use the following environment variables:
332 The git Repository
333 ~~~~~~~~~~~~~~~~~~
334 These environment variables apply to 'all' core git commands. Nb: it
335 is worth noting that they may be used/overridden by SCMS sitting above
336 git so take care if using Cogito etc.
338 'GIT_INDEX_FILE'::
339         This environment allows the specification of an alternate
340         index file. If not specified, the default of `$GIT_DIR/index`
341         is used.
343 'GIT_OBJECT_DIRECTORY'::
344         If the object storage directory is specified via this
345         environment variable then the sha1 directories are created
346         underneath - otherwise the default `$GIT_DIR/objects`
347         directory is used.
349 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
350         Due to the immutable nature of git objects, old objects can be
351         archived into shared, read-only directories. This variable
352         specifies a ":" separated list of git object directories which
353         can be used to search for git objects. New objects will not be
354         written to these directories.
356 'GIT_DIR'::
357         If the 'GIT_DIR' environment variable is set then it
358         specifies a path to use instead of the default `.git`
359         for the base of the repository.
361 'GIT_WORK_TREE'::
362         Set the path to the working tree.  The value will not be
363         used in combination with repositories found automatically in
364         a .git directory (i.e. $GIT_DIR is not set).
365         This can also be controlled by the '--work-tree' command line
366         option and the core.worktree configuration variable.
368 git Commits
369 ~~~~~~~~~~~
370 'GIT_AUTHOR_NAME'::
371 'GIT_AUTHOR_EMAIL'::
372 'GIT_AUTHOR_DATE'::
373 'GIT_COMMITTER_NAME'::
374 'GIT_COMMITTER_EMAIL'::
375 'GIT_COMMITTER_DATE'::
376 'EMAIL'::
377         see gitlink:git-commit-tree[1]
379 git Diffs
380 ~~~~~~~~~
381 'GIT_DIFF_OPTS'::
382         Only valid setting is "--unified=??" or "-u??" to set the
383         number of context lines shown when a unified diff is created.
384         This takes precedence over any "-U" or "--unified" option
385         value passed on the git diff command line.
387 'GIT_EXTERNAL_DIFF'::
388         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
389         program named by it is called, instead of the diff invocation
390         described above.  For a path that is added, removed, or modified,
391         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
393         path old-file old-hex old-mode new-file new-hex new-mode
395 where:
397         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
398                          contents of <old|new>,
399         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
400         <old|new>-mode:: are the octal representation of the file modes.
403 The file parameters can point at the user's working file
404 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
405 when a new file is added), or a temporary file (e.g. `old-file` in the
406 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
407 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
409 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
410 parameter, <path>.
412 other
413 ~~~~~
414 'GIT_MERGE_VERBOSITY'::
415         A number controlling the amount of output shown by
416         the recursive merge strategy.  Overrides merge.verbosity.
417         See gitlink:git-merge[1]
419 'GIT_PAGER'::
420         This environment variable overrides `$PAGER`. If it is set
421         to an empty string or to the value "cat", git will not launch
422         a pager.
424 'GIT_FLUSH'::
425         If this environment variable is set to "1", then commands such
426         as git-blame (in incremental mode), git-rev-list, git-log,
427         git-whatchanged, etc., will force a flush of the output stream
428         after each commit-oriented record have been flushed.   If this
429         variable is set to "0", the output of these commands will be done
430         using completely buffered I/O.   If this environment variable is
431         not set, git will choose buffered or record-oriented flushing
432         based on whether stdout appears to be redirected to a file or not.
434 'GIT_TRACE'::
435         If this variable is set to "1", "2" or "true" (comparison
436         is case insensitive), git will print `trace:` messages on
437         stderr telling about alias expansion, built-in command
438         execution and external command execution.
439         If this variable is set to an integer value greater than 1
440         and lower than 10 (strictly) then git will interpret this
441         value as an open file descriptor and will try to write the
442         trace messages into this file descriptor.
443         Alternatively, if this variable is set to an absolute path
444         (starting with a '/' character), git will interpret this
445         as a file path and will try to write the trace messages
446         into it.
448 Discussion[[Discussion]]
449 ------------------------
450 include::core-intro.txt[]
452 Authors
453 -------
454 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
455 * The current git nurse is Junio C Hamano <junkio@cox.net>.
456 * The git potty was written by Andres Ericsson <ae@op5.se>.
457 * General upbringing is handled by the git-list <git@vger.kernel.org>.
459 Documentation
460 --------------
461 The documentation for git suite was started by David Greaves
462 <david@dgreaves.com>, and later enhanced greatly by the
463 contributors on the git-list <git@vger.kernel.org>.
467 Part of the gitlink:git[7] suite