Code

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