]> asedeno.scripts.mit.edu Git - git.git/blob - Documentation/git.txt
Update documentation links for older releases.
[git.git] / Documentation / git.txt
1 git(7)
2 ======
3
4 NAME
5 ----
6 git - the stupid content tracker
7
8
9 SYNOPSIS
10 --------
11 [verse]
12 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
13     [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
14     [--help] COMMAND [ARGS]
15
16 DESCRIPTION
17 -----------
18 Git is a fast, scalable, distributed revision control system with an
19 unusually rich command set that provides both high-level operations
20 and full access to internals.
21
22 See this link:tutorial.html[tutorial] to get started, then see
23 link:everyday.html[Everyday Git] for a useful minimum set of commands, and
24 "man git-commandname" for documentation of each command.  CVS users may
25 also want to read link:cvs-migration.html[CVS migration].  See
26 link:user-manual.html[Git User's Manual] for a more in-depth
27 introduction.
28
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]).
31
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/`.
35
36 ifdef::stalenotes[]
37 [NOTE]
38 ============
39
40 You are reading the documentation for the latest (possibly
41 unreleased) version of git, that is available from 'master'
42 branch of the `git.git` repository.
43 Documentation for older releases are available here:
44
45 * link:v1.5.2.5/git.html[documentation for release 1.5.2.5]
46
47 * release notes for
48   link:RelNotes-1.5.2.5.txt[1.5.2.5],
49   link:RelNotes-1.5.2.4.txt[1.5.2.4],
50   link:RelNotes-1.5.2.3.txt[1.5.2.3],
51   link:RelNotes-1.5.2.2.txt[1.5.2.2],
52   link:RelNotes-1.5.2.1.txt[1.5.2.1],
53   link:RelNotes-1.5.2.txt[1.5.2].
54
55 * link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
56
57 * release notes for
58   link:RelNotes-1.5.1.6.txt[1.5.1.6],
59   link:RelNotes-1.5.1.5.txt[1.5.1.5],
60   link:RelNotes-1.5.1.4.txt[1.5.1.4],
61   link:RelNotes-1.5.1.3.txt[1.5.1.3],
62   link:RelNotes-1.5.1.2.txt[1.5.1.2],
63   link:RelNotes-1.5.1.1.txt[1.5.1.1],
64   link:RelNotes-1.5.1.txt[1.5.1].
65
66 * link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
67
68 * release notes for
69   link:RelNotes-1.5.0.7.txt[1.5.0.7],
70   link:RelNotes-1.5.0.6.txt[1.5.0.6],
71   link:RelNotes-1.5.0.5.txt[1.5.0.5],
72   link:RelNotes-1.5.0.3.txt[1.5.0.3],
73   link:RelNotes-1.5.0.2.txt[1.5.0.2],
74   link:RelNotes-1.5.0.1.txt[1.5.0.1],
75   link:RelNotes-1.5.0.txt[1.5.0].
76
77 * documentation for release link:v1.4.4.4/git.html[1.4.4.4],
78   link:v1.3.3/git.html[1.3.3],
79   link:v1.2.6/git.html[1.2.6],
80   link:v1.0.13/git.html[1.0.13].
81
82 ============
83
84 endif::stalenotes[]
85
86 OPTIONS
87 -------
88 --version::
89         Prints the git suite version that the 'git' program came from.
90
91 --help::
92         Prints the synopsis and a list of the most commonly used
93         commands.  If a git command is named this option will bring up
94         the man-page for that command. If the option '--all' or '-a' is
95         given then all available commands are printed.
96
97 --exec-path::
98         Path to wherever your core git programs are installed.
99         This can also be controlled by setting the GIT_EXEC_PATH
100         environment variable. If no path is given 'git' will print
101         the current setting and then exit.
102
103 -p|--paginate::
104         Pipe all output into 'less' (or if set, $PAGER).
105
106 --git-dir=<path>::
107         Set the path to the repository. This can also be controlled by
108         setting the GIT_DIR environment variable.
109
110 --work-tree=<path>::
111         Set the path to the working tree.  The value will not be
112         used in combination with repositories found automatically in
113         a .git directory (i.e. $GIT_DIR is not set).
114         This can also be controlled by setting the GIT_WORK_TREE
115         environment variable and the core.worktree configuration
116         variable.
117
118 --bare::
119         Same as --git-dir=`pwd`.
120
121 FURTHER DOCUMENTATION
122 ---------------------
123
124 See the references above to get started using git.  The following is
125 probably more detail than necessary for a first-time user.
126
127 The <<Discussion,Discussion>> section below and the
128 link:core-tutorial.html[Core tutorial] both provide introductions to the
129 underlying git architecture.
130
131 See also the link:howto-index.html[howto] documents for some useful
132 examples.
133
134 GIT COMMANDS
135 ------------
136
137 We divide git into high level ("porcelain") commands and low level
138 ("plumbing") commands.
139
140 High-level commands (porcelain)
141 -------------------------------
142
143 We separate the porcelain commands into the main commands and some
144 ancillary user utilities.
145
146 Main porcelain commands
147 ~~~~~~~~~~~~~~~~~~~~~~~
148
149 include::cmds-mainporcelain.txt[]
150
151 Ancillary Commands
152 ~~~~~~~~~~~~~~~~~~
153 Manipulators:
154
155 include::cmds-ancillarymanipulators.txt[]
156
157 Interrogators:
158
159 include::cmds-ancillaryinterrogators.txt[]
160
161
162 Interacting with Others
163 ~~~~~~~~~~~~~~~~~~~~~~~
164
165 These commands are to interact with foreign SCM and with other
166 people via patch over e-mail.
167
168 include::cmds-foreignscminterface.txt[]
169
170
171 Low-level commands (plumbing)
172 -----------------------------
173
174 Although git includes its
175 own porcelain layer, its low-level commands are sufficient to support
176 development of alternative porcelains.  Developers of such porcelains
177 might start by reading about gitlink:git-update-index[1] and
178 gitlink:git-read-tree[1].
179
180 The interface (input, output, set of options and the semantics)
181 to these low-level commands are meant to be a lot more stable
182 than Porcelain level commands, because these commands are
183 primarily for scripted use.  The interface to Porcelain commands
184 on the other hand are subject to change in order to improve the
185 end user experience.
186
187 The following description divides
188 the low-level commands into commands that manipulate objects (in
189 the repository, index, and working tree), commands that interrogate and
190 compare objects, and commands that move objects and references between
191 repositories.
192
193
194 Manipulation commands
195 ~~~~~~~~~~~~~~~~~~~~~
196
197 include::cmds-plumbingmanipulators.txt[]
198
199
200 Interrogation commands
201 ~~~~~~~~~~~~~~~~~~~~~~
202
203 include::cmds-plumbinginterrogators.txt[]
204
205 In general, the interrogate commands do not touch the files in
206 the working tree.
207
208
209 Synching repositories
210 ~~~~~~~~~~~~~~~~~~~~~
211
212 include::cmds-synchingrepositories.txt[]
213
214 The following are helper programs used by the above; end users
215 typically do not use them directly.
216
217 include::cmds-synchelpers.txt[]
218
219
220 Internal helper commands
221 ~~~~~~~~~~~~~~~~~~~~~~~~
222
223 These are internal helper commands used by other commands; end
224 users typically do not use them directly.
225
226 include::cmds-purehelpers.txt[]
227
228
229 Configuration Mechanism
230 -----------------------
231
232 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
233 is used to hold per-repository configuration options.  It is a
234 simple text file modeled after `.ini` format familiar to some
235 people.  Here is an example:
236
237 ------------
238 #
239 # A '#' or ';' character indicates a comment.
240 #
241
242 ; core variables
243 [core]
244         ; Don't trust file modes
245         filemode = false
246
247 ; user identity
248 [user]
249         name = "Junio C Hamano"
250         email = "junkio@twinsun.com"
251
252 ------------
253
254 Various commands read from the configuration file and adjust
255 their operation accordingly.
256
257
258 Identifier Terminology
259 ----------------------
260 <object>::
261         Indicates the object name for any type of object.
262
263 <blob>::
264         Indicates a blob object name.
265
266 <tree>::
267         Indicates a tree object name.
268
269 <commit>::
270         Indicates a commit object name.
271
272 <tree-ish>::
273         Indicates a tree, commit or tag object name.  A
274         command that takes a <tree-ish> argument ultimately wants to
275         operate on a <tree> object but automatically dereferences
276         <commit> and <tag> objects that point at a <tree>.
277
278 <commit-ish>::
279         Indicates a commit or tag object name.  A
280         command that takes a <commit-ish> argument ultimately wants to
281         operate on a <commit> object but automatically dereferences
282         <tag> objects that point at a <commit>.
283
284 <type>::
285         Indicates that an object type is required.
286         Currently one of: `blob`, `tree`, `commit`, or `tag`.
287
288 <file>::
289         Indicates a filename - almost always relative to the
290         root of the tree structure `GIT_INDEX_FILE` describes.
291
292 Symbolic Identifiers
293 --------------------
294 Any git command accepting any <object> can also use the following
295 symbolic notation:
296
297 HEAD::
298         indicates the head of the current branch (i.e. the
299         contents of `$GIT_DIR/HEAD`).
300
301 <tag>::
302         a valid tag 'name'
303         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
304
305 <head>::
306         a valid head 'name'
307         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
308
309 For a more complete list of ways to spell object names, see
310 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
311
312
313 File/Directory Structure
314 ------------------------
315
316 Please see link:repository-layout.html[repository layout] document.
317
318 Read link:hooks.html[hooks] for more details about each hook.
319
320 Higher level SCMs may provide and manage additional information in the
321 `$GIT_DIR`.
322
323
324 Terminology
325 -----------
326 Please see link:glossary.html[glossary] document.
327
328
329 Environment Variables
330 ---------------------
331 Various git commands use the following environment variables:
332
333 The git Repository
334 ~~~~~~~~~~~~~~~~~~
335 These environment variables apply to 'all' core git commands. Nb: it
336 is worth noting that they may be used/overridden by SCMS sitting above
337 git so take care if using Cogito etc.
338
339 'GIT_INDEX_FILE'::
340         This environment allows the specification of an alternate
341         index file. If not specified, the default of `$GIT_DIR/index`
342         is used.
343
344 'GIT_OBJECT_DIRECTORY'::
345         If the object storage directory is specified via this
346         environment variable then the sha1 directories are created
347         underneath - otherwise the default `$GIT_DIR/objects`
348         directory is used.
349
350 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
351         Due to the immutable nature of git objects, old objects can be
352         archived into shared, read-only directories. This variable
353         specifies a ":" separated list of git object directories which
354         can be used to search for git objects. New objects will not be
355         written to these directories.
356
357 'GIT_DIR'::
358         If the 'GIT_DIR' environment variable is set then it
359         specifies a path to use instead of the default `.git`
360         for the base of the repository.
361
362 'GIT_WORK_TREE'::
363         Set the path to the working tree.  The value will not be
364         used in combination with repositories found automatically in
365         a .git directory (i.e. $GIT_DIR is not set).
366         This can also be controlled by the '--work-tree' command line
367         option and the core.worktree configuration variable.
368
369 git Commits
370 ~~~~~~~~~~~
371 'GIT_AUTHOR_NAME'::
372 'GIT_AUTHOR_EMAIL'::
373 'GIT_AUTHOR_DATE'::
374 'GIT_COMMITTER_NAME'::
375 'GIT_COMMITTER_EMAIL'::
376 'GIT_COMMITTER_DATE'::
377 'EMAIL'::
378         see gitlink:git-commit-tree[1]
379
380 git Diffs
381 ~~~~~~~~~
382 'GIT_DIFF_OPTS'::
383         Only valid setting is "--unified=??" or "-u??" to set the
384         number of context lines shown when a unified diff is created.
385         This takes precedence over any "-U" or "--unified" option
386         value passed on the git diff command line.
387
388 'GIT_EXTERNAL_DIFF'::
389         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
390         program named by it is called, instead of the diff invocation
391         described above.  For a path that is added, removed, or modified,
392         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
393
394         path old-file old-hex old-mode new-file new-hex new-mode
395 +
396 where:
397
398         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
399                          contents of <old|new>,
400         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
401         <old|new>-mode:: are the octal representation of the file modes.
402
403 +
404 The file parameters can point at the user's working file
405 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
406 when a new file is added), or a temporary file (e.g. `old-file` in the
407 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
408 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
409 +
410 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
411 parameter, <path>.
412
413 other
414 ~~~~~
415 'GIT_MERGE_VERBOSITY'::
416         A number controlling the amount of output shown by
417         the recursive merge strategy.  Overrides merge.verbosity.
418         See gitlink:git-merge[1]
419
420 'GIT_PAGER'::
421         This environment variable overrides `$PAGER`. If it is set
422         to an empty string or to the value "cat", git will not launch
423         a pager.
424
425 'GIT_SSH'::
426         If this environment variable is set then gitlink:git-fetch[1]
427         and gitlink:git-push[1] will use this command instead
428         of `ssh` when they need to connect to a remote system.
429         The 'GIT_SSH' command will be given exactly two arguments:
430         the 'username@host' (or just 'host') from the URL and the
431         shell command to execute on that remote system.
432 +
433 To pass options to the program that you want to list in GIT_SSH
434 you will need to wrap the program and options into a shell script,
435 then set GIT_SSH to refer to the shell script.
436 +
437 Usually it is easier to configure any desired options through your
438 personal `.ssh/config` file.  Please consult your ssh documentation
439 for further details.
440
441 'GIT_FLUSH'::
442         If this environment variable is set to "1", then commands such
443         as git-blame (in incremental mode), git-rev-list, git-log,
444         git-whatchanged, etc., will force a flush of the output stream
445         after each commit-oriented record have been flushed.   If this
446         variable is set to "0", the output of these commands will be done
447         using completely buffered I/O.   If this environment variable is
448         not set, git will choose buffered or record-oriented flushing
449         based on whether stdout appears to be redirected to a file or not.
450
451 'GIT_TRACE'::
452         If this variable is set to "1", "2" or "true" (comparison
453         is case insensitive), git will print `trace:` messages on
454         stderr telling about alias expansion, built-in command
455         execution and external command execution.
456         If this variable is set to an integer value greater than 1
457         and lower than 10 (strictly) then git will interpret this
458         value as an open file descriptor and will try to write the
459         trace messages into this file descriptor.
460         Alternatively, if this variable is set to an absolute path
461         (starting with a '/' character), git will interpret this
462         as a file path and will try to write the trace messages
463         into it.
464
465 Discussion[[Discussion]]
466 ------------------------
467 include::core-intro.txt[]
468
469 Authors
470 -------
471 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
472 * The current git nurse is Junio C Hamano <junkio@cox.net>.
473 * The git potty was written by Andres Ericsson <ae@op5.se>.
474 * General upbringing is handled by the git-list <git@vger.kernel.org>.
475
476 Documentation
477 --------------
478 The documentation for git suite was started by David Greaves
479 <david@dgreaves.com>, and later enhanced greatly by the
480 contributors on the git-list <git@vger.kernel.org>.
481
482 GIT
483 ---
484 Part of the gitlink:git[7] suite