Code

Merge branch 'master' of git://repo.or.cz/git-gui into 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].
25 link:user-manual.html[Git User's Manual] is still work in
26 progress, but when finished hopefully it will guide a new user
27 in a coherent way to git enlightenment ;-).
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 ifdef::stalenotes[]
33 [NOTE]
34 ============
35 You are reading the documentation for the latest version of git.
36 Documentation for older releases are available here:
38 * link:v1.4.4.4/git.html[documentation for release 1.4.4.4]
40 * link:v1.3.3/git.html[documentation for release 1.3.3]
42 * link:v1.2.6/git.html[documentation for release 1.2.6]
44 * link:v1.0.13/git.html[documentation for release 1.0.13]
46 ============
48 endif::stalenotes[]
50 OPTIONS
51 -------
52 --version::
53         Prints the git suite version that the 'git' program came from.
55 --help::
56         Prints the synopsis and a list of the most commonly used
57         commands.  If a git command is named this option will bring up
58         the man-page for that command. If the option '--all' or '-a' is
59         given then all available commands are printed.
61 --exec-path::
62         Path to wherever your core git programs are installed.
63         This can also be controlled by setting the GIT_EXEC_PATH
64         environment variable. If no path is given 'git' will print
65         the current setting and then exit.
67 -p|--paginate::
68         Pipe all output into 'less' (or if set, $PAGER).
70 --git-dir=<path>::
71         Set the path to the repository. This can also be controlled by
72         setting the GIT_DIR environment variable.
74 --bare::
75         Same as --git-dir=`pwd`.
77 FURTHER DOCUMENTATION
78 ---------------------
80 See the references above to get started using git.  The following is
81 probably more detail than necessary for a first-time user.
83 The <<Discussion,Discussion>> section below and the
84 link:core-tutorial.html[Core tutorial] both provide introductions to the
85 underlying git architecture.
87 See also the link:howto-index.html[howto] documents for some useful
88 examples.
90 GIT COMMANDS
91 ------------
93 We divide git into high level ("porcelain") commands and low level
94 ("plumbing") commands.
96 High-level commands (porcelain)
97 -------------------------------
99 We separate the porcelain commands into the main commands and some
100 ancillary user utilities.
102 Main porcelain commands
103 ~~~~~~~~~~~~~~~~~~~~~~~
105 include::cmds-mainporcelain.txt[]
107 Ancillary Commands
108 ~~~~~~~~~~~~~~~~~~
109 Manipulators:
111 include::cmds-ancillarymanipulators.txt[]
113 Interrogators:
115 include::cmds-ancillaryinterrogators.txt[]
118 Interacting with Others
119 ~~~~~~~~~~~~~~~~~~~~~~~
121 These commands are to interact with foreign SCM and with other
122 people via patch over e-mail.
124 include::cmds-foreignscminterface.txt[]
127 Low-level commands (plumbing)
128 -----------------------------
130 Although git includes its
131 own porcelain layer, its low-level commands are sufficient to support
132 development of alternative porcelains.  Developers of such porcelains
133 might start by reading about gitlink:git-update-index[1] and
134 gitlink:git-read-tree[1].
136 The interface (input, output, set of options and the semantics)
137 to these low-level commands are meant to be a lot more stable
138 than Porcelain level commands, because these commands are
139 primarily for scripted use.  The interface to Porcelain commands
140 on the other hand are subject to change in order to improve the
141 end user experience.
143 The following description divides
144 the low-level commands into commands that manipulate objects (in
145 the repository, index, and working tree), commands that interrogate and
146 compare objects, and commands that move objects and references between
147 repositories.
150 Manipulation commands
151 ~~~~~~~~~~~~~~~~~~~~~
153 include::cmds-plumbingmanipulators.txt[]
156 Interrogation commands
157 ~~~~~~~~~~~~~~~~~~~~~~
159 include::cmds-plumbinginterrogators.txt[]
161 In general, the interrogate commands do not touch the files in
162 the working tree.
165 Synching repositories
166 ~~~~~~~~~~~~~~~~~~~~~
168 include::cmds-synchingrepositories.txt[]
170 The following are helper programs used by the above; end users
171 typically do not use them directly.
173 include::cmds-synchelpers.txt[]
176 Internal helper commands
177 ~~~~~~~~~~~~~~~~~~~~~~~~
179 These are internal helper commands used by other commands; end
180 users typically do not use them directly.
182 include::cmds-purehelpers.txt[]
185 Configuration Mechanism
186 -----------------------
188 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
189 is used to hold per-repository configuration options.  It is a
190 simple text file modeled after `.ini` format familiar to some
191 people.  Here is an example:
193 ------------
195 # A '#' or ';' character indicates a comment.
198 ; core variables
199 [core]
200         ; Don't trust file modes
201         filemode = false
203 ; user identity
204 [user]
205         name = "Junio C Hamano"
206         email = "junkio@twinsun.com"
208 ------------
210 Various commands read from the configuration file and adjust
211 their operation accordingly.
214 Identifier Terminology
215 ----------------------
216 <object>::
217         Indicates the object name for any type of object.
219 <blob>::
220         Indicates a blob object name.
222 <tree>::
223         Indicates a tree object name.
225 <commit>::
226         Indicates a commit object name.
228 <tree-ish>::
229         Indicates a tree, commit or tag object name.  A
230         command that takes a <tree-ish> argument ultimately wants to
231         operate on a <tree> object but automatically dereferences
232         <commit> and <tag> objects that point at a <tree>.
234 <commit-ish>::
235         Indicates a commit or tag object name.  A
236         command that takes a <commit-ish> argument ultimately wants to
237         operate on a <commit> object but automatically dereferences
238         <tag> objects that point at a <commit>.
240 <type>::
241         Indicates that an object type is required.
242         Currently one of: `blob`, `tree`, `commit`, or `tag`.
244 <file>::
245         Indicates a filename - almost always relative to the
246         root of the tree structure `GIT_INDEX_FILE` describes.
248 Symbolic Identifiers
249 --------------------
250 Any git command accepting any <object> can also use the following
251 symbolic notation:
253 HEAD::
254         indicates the head of the current branch (i.e. the
255         contents of `$GIT_DIR/HEAD`).
257 <tag>::
258         a valid tag 'name'
259         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
261 <head>::
262         a valid head 'name'
263         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
265 For a more complete list of ways to spell object names, see
266 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
269 File/Directory Structure
270 ------------------------
272 Please see link:repository-layout.html[repository layout] document.
274 Read link:hooks.html[hooks] for more details about each hook.
276 Higher level SCMs may provide and manage additional information in the
277 `$GIT_DIR`.
280 Terminology
281 -----------
282 Please see link:glossary.html[glossary] document.
285 Environment Variables
286 ---------------------
287 Various git commands use the following environment variables:
289 The git Repository
290 ~~~~~~~~~~~~~~~~~~
291 These environment variables apply to 'all' core git commands. Nb: it
292 is worth noting that they may be used/overridden by SCMS sitting above
293 git so take care if using Cogito etc.
295 'GIT_INDEX_FILE'::
296         This environment allows the specification of an alternate
297         index file. If not specified, the default of `$GIT_DIR/index`
298         is used.
300 'GIT_OBJECT_DIRECTORY'::
301         If the object storage directory is specified via this
302         environment variable then the sha1 directories are created
303         underneath - otherwise the default `$GIT_DIR/objects`
304         directory is used.
306 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
307         Due to the immutable nature of git objects, old objects can be
308         archived into shared, read-only directories. This variable
309         specifies a ":" separated list of git object directories which
310         can be used to search for git objects. New objects will not be
311         written to these directories.
313 'GIT_DIR'::
314         If the 'GIT_DIR' environment variable is set then it
315         specifies a path to use instead of the default `.git`
316         for the base of the repository.
318 git Commits
319 ~~~~~~~~~~~
320 'GIT_AUTHOR_NAME'::
321 'GIT_AUTHOR_EMAIL'::
322 'GIT_AUTHOR_DATE'::
323 'GIT_COMMITTER_NAME'::
324 'GIT_COMMITTER_EMAIL'::
325         see gitlink:git-commit-tree[1]
327 git Diffs
328 ~~~~~~~~~
329 'GIT_DIFF_OPTS'::
330         Only valid setting is "--unified=??" or "-u??" to set the
331         number of context lines shown when a unified diff is created.
332         This takes precedence over any "-U" or "--unified" option
333         value passed on the git diff command line.
335 'GIT_EXTERNAL_DIFF'::
336         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
337         program named by it is called, instead of the diff invocation
338         described above.  For a path that is added, removed, or modified,
339         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
341         path old-file old-hex old-mode new-file new-hex new-mode
343 where:
345         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
346                          contents of <old|new>,
347         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
348         <old|new>-mode:: are the octal representation of the file modes.
351 The file parameters can point at the user's working file
352 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
353 when a new file is added), or a temporary file (e.g. `old-file` in the
354 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
355 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
357 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
358 parameter, <path>.
360 other
361 ~~~~~
362 'GIT_PAGER'::
363         This environment variable overrides `$PAGER`.
365 'GIT_TRACE'::
366         If this variable is set to "1", "2" or "true" (comparison
367         is case insensitive), git will print `trace:` messages on
368         stderr telling about alias expansion, built-in command
369         execution and external command execution.
370         If this variable is set to an integer value greater than 1
371         and lower than 10 (strictly) then git will interpret this
372         value as an open file descriptor and will try to write the
373         trace messages into this file descriptor.
374         Alternatively, if this variable is set to an absolute path
375         (starting with a '/' character), git will interpret this
376         as a file path and will try to write the trace messages
377         into it.
379 Discussion[[Discussion]]
380 ------------------------
381 include::core-intro.txt[]
383 Authors
384 -------
385 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
386 * The current git nurse is Junio C Hamano <junkio@cox.net>.
387 * The git potty was written by Andres Ericsson <ae@op5.se>.
388 * General upbringing is handled by the git-list <git@vger.kernel.org>.
390 Documentation
391 --------------
392 The documentation for git suite was started by David Greaves
393 <david@dgreaves.com>, and later enhanced greatly by the
394 contributors on the git-list <git@vger.kernel.org>.
396 GIT
397 ---
398 Part of the gitlink:git[7] suite