Code

Merge branch 'maint'
[git.git] / Documentation / git.txt
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] [--help] COMMAND [ARGS]
15 DESCRIPTION
16 -----------
17 Git is a fast, scalable, distributed revision control system with an
18 unusually rich command set that provides both high-level operations
19 and full access to internals.
21 See this link:tutorial.html[tutorial] to get started, then see
22 link:everyday.html[Everyday Git] for a useful minimum set of commands, and
23 "man git-commandname" for documentation of each command.  CVS users may
24 also want to read link:cvs-migration.html[CVS migration].  See
25 link:user-manual.html[Git User's Manual] for a more in-depth
26 introduction.
28 The COMMAND is either a name of a Git command (see below) or an alias
29 as defined in the configuration file (see gitlink:git-config[1]).
31 Formatted and hyperlinked version of the latest git
32 documentation can be viewed at
33 `http://www.kernel.org/pub/software/scm/git/docs/`.
35 ifdef::stalenotes[]
36 [NOTE]
37 ============
38 You are reading the documentation for the latest version of git.
39 Documentation for older releases are available here:
41 * link:RelNotes-1.5.1.txt[release notes for 1.5.1]
43 * link:v1.5.1.2/git.html[documentation for release 1.5.1.2]
45 * link:RelNotes-1.5.1.2.txt[release notes for 1.5.1.2]
47 * link:RelNotes-1.5.1.1.txt[release notes for 1.5.1.1]
49 * link:RelNotes-1.5.0.7.txt[release notes for 1.5.0.7]
51 * link:RelNotes-1.5.0.6.txt[release notes for 1.5.0.6]
53 * link:RelNotes-1.5.0.5.txt[release notes for 1.5.0.5]
55 * link:RelNotes-1.5.0.3.txt[release notes for 1.5.0.3]
57 * link:RelNotes-1.5.0.2.txt[release notes for 1.5.0.2]
59 * link:RelNotes-1.5.0.1.txt[release notes for 1.5.0.1]
61 * link:RelNotes-1.5.0.txt[release notes for 1.5.0]
63 * link:v1.4.4.4/git.html[documentation for release 1.4.4.4]
65 * link:v1.3.3/git.html[documentation for release 1.3.3]
67 * link:v1.2.6/git.html[documentation for release 1.2.6]
69 * link:v1.0.13/git.html[documentation for release 1.0.13]
71 ============
73 endif::stalenotes[]
75 OPTIONS
76 -------
77 --version::
78         Prints the git suite version that the 'git' program came from.
80 --help::
81         Prints the synopsis and a list of the most commonly used
82         commands.  If a git command is named this option will bring up
83         the man-page for that command. If the option '--all' or '-a' is
84         given then all available commands are printed.
86 --exec-path::
87         Path to wherever your core git programs are installed.
88         This can also be controlled by setting the GIT_EXEC_PATH
89         environment variable. If no path is given 'git' will print
90         the current setting and then exit.
92 -p|--paginate::
93         Pipe all output into 'less' (or if set, $PAGER).
95 --git-dir=<path>::
96         Set the path to the repository. This can also be controlled by
97         setting the GIT_DIR environment variable.
99 --bare::
100         Same as --git-dir=`pwd`.
102 FURTHER DOCUMENTATION
103 ---------------------
105 See the references above to get started using git.  The following is
106 probably more detail than necessary for a first-time user.
108 The <<Discussion,Discussion>> section below and the
109 link:core-tutorial.html[Core tutorial] both provide introductions to the
110 underlying git architecture.
112 See also the link:howto-index.html[howto] documents for some useful
113 examples.
115 GIT COMMANDS
116 ------------
118 We divide git into high level ("porcelain") commands and low level
119 ("plumbing") commands.
121 High-level commands (porcelain)
122 -------------------------------
124 We separate the porcelain commands into the main commands and some
125 ancillary user utilities.
127 Main porcelain commands
128 ~~~~~~~~~~~~~~~~~~~~~~~
130 include::cmds-mainporcelain.txt[]
132 Ancillary Commands
133 ~~~~~~~~~~~~~~~~~~
134 Manipulators:
136 include::cmds-ancillarymanipulators.txt[]
138 Interrogators:
140 include::cmds-ancillaryinterrogators.txt[]
143 Interacting with Others
144 ~~~~~~~~~~~~~~~~~~~~~~~
146 These commands are to interact with foreign SCM and with other
147 people via patch over e-mail.
149 include::cmds-foreignscminterface.txt[]
152 Low-level commands (plumbing)
153 -----------------------------
155 Although git includes its
156 own porcelain layer, its low-level commands are sufficient to support
157 development of alternative porcelains.  Developers of such porcelains
158 might start by reading about gitlink:git-update-index[1] and
159 gitlink:git-read-tree[1].
161 The interface (input, output, set of options and the semantics)
162 to these low-level commands are meant to be a lot more stable
163 than Porcelain level commands, because these commands are
164 primarily for scripted use.  The interface to Porcelain commands
165 on the other hand are subject to change in order to improve the
166 end user experience.
168 The following description divides
169 the low-level commands into commands that manipulate objects (in
170 the repository, index, and working tree), commands that interrogate and
171 compare objects, and commands that move objects and references between
172 repositories.
175 Manipulation commands
176 ~~~~~~~~~~~~~~~~~~~~~
178 include::cmds-plumbingmanipulators.txt[]
181 Interrogation commands
182 ~~~~~~~~~~~~~~~~~~~~~~
184 include::cmds-plumbinginterrogators.txt[]
186 In general, the interrogate commands do not touch the files in
187 the working tree.
190 Synching repositories
191 ~~~~~~~~~~~~~~~~~~~~~
193 include::cmds-synchingrepositories.txt[]
195 The following are helper programs used by the above; end users
196 typically do not use them directly.
198 include::cmds-synchelpers.txt[]
201 Internal helper commands
202 ~~~~~~~~~~~~~~~~~~~~~~~~
204 These are internal helper commands used by other commands; end
205 users typically do not use them directly.
207 include::cmds-purehelpers.txt[]
210 Configuration Mechanism
211 -----------------------
213 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
214 is used to hold per-repository configuration options.  It is a
215 simple text file modeled after `.ini` format familiar to some
216 people.  Here is an example:
218 ------------
220 # A '#' or ';' character indicates a comment.
223 ; core variables
224 [core]
225         ; Don't trust file modes
226         filemode = false
228 ; user identity
229 [user]
230         name = "Junio C Hamano"
231         email = "junkio@twinsun.com"
233 ------------
235 Various commands read from the configuration file and adjust
236 their operation accordingly.
239 Identifier Terminology
240 ----------------------
241 <object>::
242         Indicates the object name for any type of object.
244 <blob>::
245         Indicates a blob object name.
247 <tree>::
248         Indicates a tree object name.
250 <commit>::
251         Indicates a commit object name.
253 <tree-ish>::
254         Indicates a tree, commit or tag object name.  A
255         command that takes a <tree-ish> argument ultimately wants to
256         operate on a <tree> object but automatically dereferences
257         <commit> and <tag> objects that point at a <tree>.
259 <commit-ish>::
260         Indicates a commit or tag object name.  A
261         command that takes a <commit-ish> argument ultimately wants to
262         operate on a <commit> object but automatically dereferences
263         <tag> objects that point at a <commit>.
265 <type>::
266         Indicates that an object type is required.
267         Currently one of: `blob`, `tree`, `commit`, or `tag`.
269 <file>::
270         Indicates a filename - almost always relative to the
271         root of the tree structure `GIT_INDEX_FILE` describes.
273 Symbolic Identifiers
274 --------------------
275 Any git command accepting any <object> can also use the following
276 symbolic notation:
278 HEAD::
279         indicates the head of the current branch (i.e. the
280         contents of `$GIT_DIR/HEAD`).
282 <tag>::
283         a valid tag 'name'
284         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
286 <head>::
287         a valid head 'name'
288         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
290 For a more complete list of ways to spell object names, see
291 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
294 File/Directory Structure
295 ------------------------
297 Please see link:repository-layout.html[repository layout] document.
299 Read link:hooks.html[hooks] for more details about each hook.
301 Higher level SCMs may provide and manage additional information in the
302 `$GIT_DIR`.
305 Terminology
306 -----------
307 Please see link:glossary.html[glossary] document.
310 Environment Variables
311 ---------------------
312 Various git commands use the following environment variables:
314 The git Repository
315 ~~~~~~~~~~~~~~~~~~
316 These environment variables apply to 'all' core git commands. Nb: it
317 is worth noting that they may be used/overridden by SCMS sitting above
318 git so take care if using Cogito etc.
320 'GIT_INDEX_FILE'::
321         This environment allows the specification of an alternate
322         index file. If not specified, the default of `$GIT_DIR/index`
323         is used.
325 'GIT_OBJECT_DIRECTORY'::
326         If the object storage directory is specified via this
327         environment variable then the sha1 directories are created
328         underneath - otherwise the default `$GIT_DIR/objects`
329         directory is used.
331 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
332         Due to the immutable nature of git objects, old objects can be
333         archived into shared, read-only directories. This variable
334         specifies a ":" separated list of git object directories which
335         can be used to search for git objects. New objects will not be
336         written to these directories.
338 'GIT_DIR'::
339         If the 'GIT_DIR' environment variable is set then it
340         specifies a path to use instead of the default `.git`
341         for the base of the repository.
343 git Commits
344 ~~~~~~~~~~~
345 'GIT_AUTHOR_NAME'::
346 'GIT_AUTHOR_EMAIL'::
347 'GIT_AUTHOR_DATE'::
348 'GIT_COMMITTER_NAME'::
349 'GIT_COMMITTER_EMAIL'::
350 'GIT_COMMITTER_DATE'::
351 'EMAIL'::
352         see gitlink:git-commit-tree[1]
354 git Diffs
355 ~~~~~~~~~
356 'GIT_DIFF_OPTS'::
357         Only valid setting is "--unified=??" or "-u??" to set the
358         number of context lines shown when a unified diff is created.
359         This takes precedence over any "-U" or "--unified" option
360         value passed on the git diff command line.
362 'GIT_EXTERNAL_DIFF'::
363         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
364         program named by it is called, instead of the diff invocation
365         described above.  For a path that is added, removed, or modified,
366         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
368         path old-file old-hex old-mode new-file new-hex new-mode
370 where:
372         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
373                          contents of <old|new>,
374         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
375         <old|new>-mode:: are the octal representation of the file modes.
378 The file parameters can point at the user's working file
379 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
380 when a new file is added), or a temporary file (e.g. `old-file` in the
381 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
382 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
384 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
385 parameter, <path>.
387 other
388 ~~~~~
389 'GIT_PAGER'::
390         This environment variable overrides `$PAGER`.
392 'GIT_TRACE'::
393         If this variable is set to "1", "2" or "true" (comparison
394         is case insensitive), git will print `trace:` messages on
395         stderr telling about alias expansion, built-in command
396         execution and external command execution.
397         If this variable is set to an integer value greater than 1
398         and lower than 10 (strictly) then git will interpret this
399         value as an open file descriptor and will try to write the
400         trace messages into this file descriptor.
401         Alternatively, if this variable is set to an absolute path
402         (starting with a '/' character), git will interpret this
403         as a file path and will try to write the trace messages
404         into it.
406 Discussion[[Discussion]]
407 ------------------------
408 include::core-intro.txt[]
410 Authors
411 -------
412 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
413 * The current git nurse is Junio C Hamano <junkio@cox.net>.
414 * The git potty was written by Andres Ericsson <ae@op5.se>.
415 * General upbringing is handled by the git-list <git@vger.kernel.org>.
417 Documentation
418 --------------
419 The documentation for git suite was started by David Greaves
420 <david@dgreaves.com>, and later enhanced greatly by the
421 contributors on the git-list <git@vger.kernel.org>.
423 GIT
424 ---
425 Part of the gitlink:git[7] suite