Code

Merge git://git.kernel.org/pub/scm/gitk/gitk 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 <type>::
235         Indicates that an object type is required.
236         Currently one of: `blob`, `tree`, `commit`, or `tag`.
238 <file>::
239         Indicates a filename - almost always relative to the
240         root of the tree structure `GIT_INDEX_FILE` describes.
242 Symbolic Identifiers
243 --------------------
244 Any git command accepting any <object> can also use the following
245 symbolic notation:
247 HEAD::
248         indicates the head of the current branch (i.e. the
249         contents of `$GIT_DIR/HEAD`).
251 <tag>::
252         a valid tag 'name'
253         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
255 <head>::
256         a valid head 'name'
257         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
259 For a more complete list of ways to spell object names, see
260 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
263 File/Directory Structure
264 ------------------------
266 Please see link:repository-layout.html[repository layout] document.
268 Read link:hooks.html[hooks] for more details about each hook.
270 Higher level SCMs may provide and manage additional information in the
271 `$GIT_DIR`.
274 Terminology
275 -----------
276 Please see link:glossary.html[glossary] document.
279 Environment Variables
280 ---------------------
281 Various git commands use the following environment variables:
283 The git Repository
284 ~~~~~~~~~~~~~~~~~~
285 These environment variables apply to 'all' core git commands. Nb: it
286 is worth noting that they may be used/overridden by SCMS sitting above
287 git so take care if using Cogito etc.
289 'GIT_INDEX_FILE'::
290         This environment allows the specification of an alternate
291         index file. If not specified, the default of `$GIT_DIR/index`
292         is used.
294 'GIT_OBJECT_DIRECTORY'::
295         If the object storage directory is specified via this
296         environment variable then the sha1 directories are created
297         underneath - otherwise the default `$GIT_DIR/objects`
298         directory is used.
300 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
301         Due to the immutable nature of git objects, old objects can be
302         archived into shared, read-only directories. This variable
303         specifies a ":" separated list of git object directories which
304         can be used to search for git objects. New objects will not be
305         written to these directories.
307 'GIT_DIR'::
308         If the 'GIT_DIR' environment variable is set then it
309         specifies a path to use instead of the default `.git`
310         for the base of the repository.
312 git Commits
313 ~~~~~~~~~~~
314 'GIT_AUTHOR_NAME'::
315 'GIT_AUTHOR_EMAIL'::
316 'GIT_AUTHOR_DATE'::
317 'GIT_COMMITTER_NAME'::
318 'GIT_COMMITTER_EMAIL'::
319         see gitlink:git-commit-tree[1]
321 git Diffs
322 ~~~~~~~~~
323 'GIT_DIFF_OPTS'::
324         Only valid setting is "--unified=??" or "-u??" to set the
325         number of context lines shown when a unified diff is created.
326         This takes precedence over any "-U" or "--unified" option
327         value passed on the git diff command line.
329 'GIT_EXTERNAL_DIFF'::
330         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
331         program named by it is called, instead of the diff invocation
332         described above.  For a path that is added, removed, or modified,
333         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
335         path old-file old-hex old-mode new-file new-hex new-mode
337 where:
339         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
340                          contents of <old|new>,
341         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
342         <old|new>-mode:: are the octal representation of the file modes.
345 The file parameters can point at the user's working file
346 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
347 when a new file is added), or a temporary file (e.g. `old-file` in the
348 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
349 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
351 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
352 parameter, <path>.
354 other
355 ~~~~~
356 'GIT_PAGER'::
357         This environment variable overrides `$PAGER`.
359 'GIT_TRACE'::
360         If this variable is set to "1", "2" or "true" (comparison
361         is case insensitive), git will print `trace:` messages on
362         stderr telling about alias expansion, built-in command
363         execution and external command execution.
364         If this variable is set to an integer value greater than 1
365         and lower than 10 (strictly) then git will interpret this
366         value as an open file descriptor and will try to write the
367         trace messages into this file descriptor.
368         Alternatively, if this variable is set to an absolute path
369         (starting with a '/' character), git will interpret this
370         as a file path and will try to write the trace messages
371         into it.
373 Discussion[[Discussion]]
374 ------------------------
375 include::core-intro.txt[]
377 Authors
378 -------
379 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
380 * The current git nurse is Junio C Hamano <junkio@cox.net>.
381 * The git potty was written by Andres Ericsson <ae@op5.se>.
382 * General upbringing is handled by the git-list <git@vger.kernel.org>.
384 Documentation
385 --------------
386 The documentation for git suite was started by David Greaves
387 <david@dgreaves.com>, and later enhanced greatly by the
388 contributors on the git-list <git@vger.kernel.org>.
390 GIT
391 ---
392 Part of the gitlink:git[7] suite