Code

Merge branch 'gfi-maint' into gfi-master
[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 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 ============
39 You are reading the documentation for the latest version of git.
40 Documentation for older releases are available here:
42 * link:RelNotes-1.5.1.txt[release notes for 1.5.1]
44 * link:v1.5.1.2/git.html[documentation for release 1.5.1.2]
46 * link:RelNotes-1.5.1.2.txt[release notes for 1.5.1.2]
48 * link:RelNotes-1.5.1.1.txt[release notes for 1.5.1.1]
50 * link:RelNotes-1.5.0.7.txt[release notes for 1.5.0.7]
52 * link:RelNotes-1.5.0.6.txt[release notes for 1.5.0.6]
54 * link:RelNotes-1.5.0.5.txt[release notes for 1.5.0.5]
56 * link:RelNotes-1.5.0.3.txt[release notes for 1.5.0.3]
58 * link:RelNotes-1.5.0.2.txt[release notes for 1.5.0.2]
60 * link:RelNotes-1.5.0.1.txt[release notes for 1.5.0.1]
62 * link:RelNotes-1.5.0.txt[release notes for 1.5.0]
64 * link:v1.4.4.4/git.html[documentation for release 1.4.4.4]
66 * link:v1.3.3/git.html[documentation for release 1.3.3]
68 * link:v1.2.6/git.html[documentation for release 1.2.6]
70 * link:v1.0.13/git.html[documentation for release 1.0.13]
72 ============
74 endif::stalenotes[]
76 OPTIONS
77 -------
78 --version::
79         Prints the git suite version that the 'git' program came from.
81 --help::
82         Prints the synopsis and a list of the most commonly used
83         commands.  If a git command is named this option will bring up
84         the man-page for that command. If the option '--all' or '-a' is
85         given then all available commands are printed.
87 --exec-path::
88         Path to wherever your core git programs are installed.
89         This can also be controlled by setting the GIT_EXEC_PATH
90         environment variable. If no path is given 'git' will print
91         the current setting and then exit.
93 -p|--paginate::
94         Pipe all output into 'less' (or if set, $PAGER).
96 --git-dir=<path>::
97         Set the path to the repository. This can also be controlled by
98         setting the GIT_DIR environment variable.
100 --bare::
101         Same as --git-dir=`pwd`.
103 FURTHER DOCUMENTATION
104 ---------------------
106 See the references above to get started using git.  The following is
107 probably more detail than necessary for a first-time user.
109 The <<Discussion,Discussion>> section below and the
110 link:core-tutorial.html[Core tutorial] both provide introductions to the
111 underlying git architecture.
113 See also the link:howto-index.html[howto] documents for some useful
114 examples.
116 GIT COMMANDS
117 ------------
119 We divide git into high level ("porcelain") commands and low level
120 ("plumbing") commands.
122 High-level commands (porcelain)
123 -------------------------------
125 We separate the porcelain commands into the main commands and some
126 ancillary user utilities.
128 Main porcelain commands
129 ~~~~~~~~~~~~~~~~~~~~~~~
131 include::cmds-mainporcelain.txt[]
133 Ancillary Commands
134 ~~~~~~~~~~~~~~~~~~
135 Manipulators:
137 include::cmds-ancillarymanipulators.txt[]
139 Interrogators:
141 include::cmds-ancillaryinterrogators.txt[]
144 Interacting with Others
145 ~~~~~~~~~~~~~~~~~~~~~~~
147 These commands are to interact with foreign SCM and with other
148 people via patch over e-mail.
150 include::cmds-foreignscminterface.txt[]
153 Low-level commands (plumbing)
154 -----------------------------
156 Although git includes its
157 own porcelain layer, its low-level commands are sufficient to support
158 development of alternative porcelains.  Developers of such porcelains
159 might start by reading about gitlink:git-update-index[1] and
160 gitlink:git-read-tree[1].
162 The interface (input, output, set of options and the semantics)
163 to these low-level commands are meant to be a lot more stable
164 than Porcelain level commands, because these commands are
165 primarily for scripted use.  The interface to Porcelain commands
166 on the other hand are subject to change in order to improve the
167 end user experience.
169 The following description divides
170 the low-level commands into commands that manipulate objects (in
171 the repository, index, and working tree), commands that interrogate and
172 compare objects, and commands that move objects and references between
173 repositories.
176 Manipulation commands
177 ~~~~~~~~~~~~~~~~~~~~~
179 include::cmds-plumbingmanipulators.txt[]
182 Interrogation commands
183 ~~~~~~~~~~~~~~~~~~~~~~
185 include::cmds-plumbinginterrogators.txt[]
187 In general, the interrogate commands do not touch the files in
188 the working tree.
191 Synching repositories
192 ~~~~~~~~~~~~~~~~~~~~~
194 include::cmds-synchingrepositories.txt[]
196 The following are helper programs used by the above; end users
197 typically do not use them directly.
199 include::cmds-synchelpers.txt[]
202 Internal helper commands
203 ~~~~~~~~~~~~~~~~~~~~~~~~
205 These are internal helper commands used by other commands; end
206 users typically do not use them directly.
208 include::cmds-purehelpers.txt[]
211 Configuration Mechanism
212 -----------------------
214 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
215 is used to hold per-repository configuration options.  It is a
216 simple text file modeled after `.ini` format familiar to some
217 people.  Here is an example:
219 ------------
221 # A '#' or ';' character indicates a comment.
224 ; core variables
225 [core]
226         ; Don't trust file modes
227         filemode = false
229 ; user identity
230 [user]
231         name = "Junio C Hamano"
232         email = "junkio@twinsun.com"
234 ------------
236 Various commands read from the configuration file and adjust
237 their operation accordingly.
240 Identifier Terminology
241 ----------------------
242 <object>::
243         Indicates the object name for any type of object.
245 <blob>::
246         Indicates a blob object name.
248 <tree>::
249         Indicates a tree object name.
251 <commit>::
252         Indicates a commit object name.
254 <tree-ish>::
255         Indicates a tree, commit or tag object name.  A
256         command that takes a <tree-ish> argument ultimately wants to
257         operate on a <tree> object but automatically dereferences
258         <commit> and <tag> objects that point at a <tree>.
260 <commit-ish>::
261         Indicates a commit or tag object name.  A
262         command that takes a <commit-ish> argument ultimately wants to
263         operate on a <commit> object but automatically dereferences
264         <tag> objects that point at a <commit>.
266 <type>::
267         Indicates that an object type is required.
268         Currently one of: `blob`, `tree`, `commit`, or `tag`.
270 <file>::
271         Indicates a filename - almost always relative to the
272         root of the tree structure `GIT_INDEX_FILE` describes.
274 Symbolic Identifiers
275 --------------------
276 Any git command accepting any <object> can also use the following
277 symbolic notation:
279 HEAD::
280         indicates the head of the current branch (i.e. the
281         contents of `$GIT_DIR/HEAD`).
283 <tag>::
284         a valid tag 'name'
285         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
287 <head>::
288         a valid head 'name'
289         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
291 For a more complete list of ways to spell object names, see
292 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
295 File/Directory Structure
296 ------------------------
298 Please see link:repository-layout.html[repository layout] document.
300 Read link:hooks.html[hooks] for more details about each hook.
302 Higher level SCMs may provide and manage additional information in the
303 `$GIT_DIR`.
306 Terminology
307 -----------
308 Please see link:glossary.html[glossary] document.
311 Environment Variables
312 ---------------------
313 Various git commands use the following environment variables:
315 The git Repository
316 ~~~~~~~~~~~~~~~~~~
317 These environment variables apply to 'all' core git commands. Nb: it
318 is worth noting that they may be used/overridden by SCMS sitting above
319 git so take care if using Cogito etc.
321 'GIT_INDEX_FILE'::
322         This environment allows the specification of an alternate
323         index file. If not specified, the default of `$GIT_DIR/index`
324         is used.
326 'GIT_OBJECT_DIRECTORY'::
327         If the object storage directory is specified via this
328         environment variable then the sha1 directories are created
329         underneath - otherwise the default `$GIT_DIR/objects`
330         directory is used.
332 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
333         Due to the immutable nature of git objects, old objects can be
334         archived into shared, read-only directories. This variable
335         specifies a ":" separated list of git object directories which
336         can be used to search for git objects. New objects will not be
337         written to these directories.
339 'GIT_DIR'::
340         If the 'GIT_DIR' environment variable is set then it
341         specifies a path to use instead of the default `.git`
342         for the base of the repository.
344 git Commits
345 ~~~~~~~~~~~
346 'GIT_AUTHOR_NAME'::
347 'GIT_AUTHOR_EMAIL'::
348 'GIT_AUTHOR_DATE'::
349 'GIT_COMMITTER_NAME'::
350 'GIT_COMMITTER_EMAIL'::
351 'GIT_COMMITTER_DATE'::
352 'EMAIL'::
353         see gitlink:git-commit-tree[1]
355 git Diffs
356 ~~~~~~~~~
357 'GIT_DIFF_OPTS'::
358         Only valid setting is "--unified=??" or "-u??" to set the
359         number of context lines shown when a unified diff is created.
360         This takes precedence over any "-U" or "--unified" option
361         value passed on the git diff command line.
363 'GIT_EXTERNAL_DIFF'::
364         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
365         program named by it is called, instead of the diff invocation
366         described above.  For a path that is added, removed, or modified,
367         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
369         path old-file old-hex old-mode new-file new-hex new-mode
371 where:
373         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
374                          contents of <old|new>,
375         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
376         <old|new>-mode:: are the octal representation of the file modes.
379 The file parameters can point at the user's working file
380 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
381 when a new file is added), or a temporary file (e.g. `old-file` in the
382 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
383 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
385 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
386 parameter, <path>.
388 other
389 ~~~~~
390 'GIT_PAGER'::
391         This environment variable overrides `$PAGER`.
393 'GIT_TRACE'::
394         If this variable is set to "1", "2" or "true" (comparison
395         is case insensitive), git will print `trace:` messages on
396         stderr telling about alias expansion, built-in command
397         execution and external command execution.
398         If this variable is set to an integer value greater than 1
399         and lower than 10 (strictly) then git will interpret this
400         value as an open file descriptor and will try to write the
401         trace messages into this file descriptor.
402         Alternatively, if this variable is set to an absolute path
403         (starting with a '/' character), git will interpret this
404         as a file path and will try to write the trace messages
405         into it.
407 Discussion[[Discussion]]
408 ------------------------
409 include::core-intro.txt[]
411 Authors
412 -------
413 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
414 * The current git nurse is Junio C Hamano <junkio@cox.net>.
415 * The git potty was written by Andres Ericsson <ae@op5.se>.
416 * General upbringing is handled by the git-list <git@vger.kernel.org>.
418 Documentation
419 --------------
420 The documentation for git suite was started by David Greaves
421 <david@dgreaves.com>, and later enhanced greatly by the
422 contributors on the git-list <git@vger.kernel.org>.
424 GIT
425 ---
426 Part of the gitlink:git[7] suite