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