Merge branch 'rc/http-push'
[git] / Documentation / git.txt
1 git(1)
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]]
13     [-p|--paginate|--no-pager]
14     [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
15     [--help] COMMAND [ARGS]
16
17 DESCRIPTION
18 -----------
19 Git is a fast, scalable, distributed revision control system with an
20 unusually rich command set that provides both high-level operations
21 and full access to internals.
22
23 See linkgit:gittutorial[7] to get started, then see
24 link:everyday.html[Everyday Git] for a useful minimum set of commands, and
25 "man git-commandname" for documentation of each command.  CVS users may
26 also want to read linkgit:gitcvs-migration[7].  See
27 the link:user-manual.html[Git User's Manual] for a more in-depth
28 introduction.
29
30 The COMMAND is either a name of a Git command (see below) or an alias
31 as defined in the configuration file (see linkgit:git-config[1]).
32
33 Formatted and hyperlinked version of the latest git
34 documentation can be viewed at
35 `http://www.kernel.org/pub/software/scm/git/docs/`.
36
37 ifdef::stalenotes[]
38 [NOTE]
39 ============
40
41 You are reading the documentation for the latest (possibly
42 unreleased) version of git, that is available from 'master'
43 branch of the `git.git` repository.
44 Documentation for older releases are available here:
45
46 * link:v1.6.1.3/git.html[documentation for release 1.6.1.3]
47
48 * release notes for
49   link:RelNotes-1.6.1.3.txt[1.6.1.3],
50   link:RelNotes-1.6.1.2.txt[1.6.1.2],
51   link:RelNotes-1.6.1.1.txt[1.6.1.1],
52   link:RelNotes-1.6.1.txt[1.6.1].
53
54 * link:v1.6.0.6/git.html[documentation for release 1.6.0.6]
55
56 * release notes for
57   link:RelNotes-1.6.0.6.txt[1.6.0.6],
58   link:RelNotes-1.6.0.5.txt[1.6.0.5],
59   link:RelNotes-1.6.0.4.txt[1.6.0.4],
60   link:RelNotes-1.6.0.3.txt[1.6.0.3],
61   link:RelNotes-1.6.0.2.txt[1.6.0.2],
62   link:RelNotes-1.6.0.1.txt[1.6.0.1],
63   link:RelNotes-1.6.0.txt[1.6.0].
64
65 * link:v1.5.6.6/git.html[documentation for release 1.5.6.6]
66
67 * release notes for
68   link:RelNotes-1.5.6.6.txt[1.5.6.6],
69   link:RelNotes-1.5.6.5.txt[1.5.6.5],
70   link:RelNotes-1.5.6.4.txt[1.5.6.4],
71   link:RelNotes-1.5.6.3.txt[1.5.6.3],
72   link:RelNotes-1.5.6.2.txt[1.5.6.2],
73   link:RelNotes-1.5.6.1.txt[1.5.6.1],
74   link:RelNotes-1.5.6.txt[1.5.6].
75
76 * link:v1.5.5.6/git.html[documentation for release 1.5.5.6]
77
78 * release notes for
79   link:RelNotes-1.5.5.6.txt[1.5.5.6],
80   link:RelNotes-1.5.5.5.txt[1.5.5.5],
81   link:RelNotes-1.5.5.4.txt[1.5.5.4],
82   link:RelNotes-1.5.5.3.txt[1.5.5.3],
83   link:RelNotes-1.5.5.2.txt[1.5.5.2],
84   link:RelNotes-1.5.5.1.txt[1.5.5.1],
85   link:RelNotes-1.5.5.txt[1.5.5].
86
87 * link:v1.5.4.7/git.html[documentation for release 1.5.4.7]
88
89 * release notes for
90   link:RelNotes-1.5.4.7.txt[1.5.4.7],
91   link:RelNotes-1.5.4.6.txt[1.5.4.6],
92   link:RelNotes-1.5.4.5.txt[1.5.4.5],
93   link:RelNotes-1.5.4.4.txt[1.5.4.4],
94   link:RelNotes-1.5.4.3.txt[1.5.4.3],
95   link:RelNotes-1.5.4.2.txt[1.5.4.2],
96   link:RelNotes-1.5.4.1.txt[1.5.4.1],
97   link:RelNotes-1.5.4.txt[1.5.4].
98
99 * link:v1.5.3.8/git.html[documentation for release 1.5.3.8]
100
101 * release notes for
102   link:RelNotes-1.5.3.8.txt[1.5.3.8],
103   link:RelNotes-1.5.3.7.txt[1.5.3.7],
104   link:RelNotes-1.5.3.6.txt[1.5.3.6],
105   link:RelNotes-1.5.3.5.txt[1.5.3.5],
106   link:RelNotes-1.5.3.4.txt[1.5.3.4],
107   link:RelNotes-1.5.3.3.txt[1.5.3.3],
108   link:RelNotes-1.5.3.2.txt[1.5.3.2],
109   link:RelNotes-1.5.3.1.txt[1.5.3.1],
110   link:RelNotes-1.5.3.txt[1.5.3].
111
112 * link:v1.5.2.5/git.html[documentation for release 1.5.2.5]
113
114 * release notes for
115   link:RelNotes-1.5.2.5.txt[1.5.2.5],
116   link:RelNotes-1.5.2.4.txt[1.5.2.4],
117   link:RelNotes-1.5.2.3.txt[1.5.2.3],
118   link:RelNotes-1.5.2.2.txt[1.5.2.2],
119   link:RelNotes-1.5.2.1.txt[1.5.2.1],
120   link:RelNotes-1.5.2.txt[1.5.2].
121
122 * link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
123
124 * release notes for
125   link:RelNotes-1.5.1.6.txt[1.5.1.6],
126   link:RelNotes-1.5.1.5.txt[1.5.1.5],
127   link:RelNotes-1.5.1.4.txt[1.5.1.4],
128   link:RelNotes-1.5.1.3.txt[1.5.1.3],
129   link:RelNotes-1.5.1.2.txt[1.5.1.2],
130   link:RelNotes-1.5.1.1.txt[1.5.1.1],
131   link:RelNotes-1.5.1.txt[1.5.1].
132
133 * link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
134
135 * release notes for
136   link:RelNotes-1.5.0.7.txt[1.5.0.7],
137   link:RelNotes-1.5.0.6.txt[1.5.0.6],
138   link:RelNotes-1.5.0.5.txt[1.5.0.5],
139   link:RelNotes-1.5.0.3.txt[1.5.0.3],
140   link:RelNotes-1.5.0.2.txt[1.5.0.2],
141   link:RelNotes-1.5.0.1.txt[1.5.0.1],
142   link:RelNotes-1.5.0.txt[1.5.0].
143
144 * documentation for release link:v1.4.4.4/git.html[1.4.4.4],
145   link:v1.3.3/git.html[1.3.3],
146   link:v1.2.6/git.html[1.2.6],
147   link:v1.0.13/git.html[1.0.13].
148
149 ============
150
151 endif::stalenotes[]
152
153 OPTIONS
154 -------
155 --version::
156         Prints the git suite version that the 'git' program came from.
157
158 --help::
159         Prints the synopsis and a list of the most commonly used
160         commands. If the option '--all' or '-a' is given then all
161         available commands are printed. If a git command is named this
162         option will bring up the manual page for that command.
163 +
164 Other options are available to control how the manual page is
165 displayed. See linkgit:git-help[1] for more information,
166 because `git --help ...` is converted internally into `git
167 help ...`.
168
169 --exec-path::
170         Path to wherever your core git programs are installed.
171         This can also be controlled by setting the GIT_EXEC_PATH
172         environment variable. If no path is given, 'git' will print
173         the current setting and then exit.
174
175 -p::
176 --paginate::
177         Pipe all output into 'less' (or if set, $PAGER).
178
179 --no-pager::
180         Do not pipe git output into a pager.
181
182 --git-dir=<path>::
183         Set the path to the repository. This can also be controlled by
184         setting the GIT_DIR environment variable. It can be an absolute
185         path or relative path to current working directory.
186
187 --work-tree=<path>::
188         Set the path to the working tree.  The value will not be
189         used in combination with repositories found automatically in
190         a .git directory (i.e. $GIT_DIR is not set).
191         This can also be controlled by setting the GIT_WORK_TREE
192         environment variable and the core.worktree configuration
193         variable. It can be an absolute path or relative path to
194         the directory specified by --git-dir or GIT_DIR.
195         Note: If --git-dir or GIT_DIR are specified but none of
196         --work-tree, GIT_WORK_TREE and core.worktree is specified,
197         the current working directory is regarded as the top directory
198         of your working tree.
199
200 --bare::
201         Treat the repository as a bare repository.  If GIT_DIR
202         environment is not set, it is set to the current working
203         directory.
204
205
206 FURTHER DOCUMENTATION
207 ---------------------
208
209 See the references above to get started using git.  The following is
210 probably more detail than necessary for a first-time user.
211
212 The link:user-manual.html#git-concepts[git concepts chapter of the
213 user-manual] and linkgit:gitcore-tutorial[7] both provide
214 introductions to the underlying git architecture.
215
216 See also the link:howto-index.html[howto] documents for some useful
217 examples.
218
219 The internals are documented in the
220 link:technical/api-index.html[GIT API documentation].
221
222 GIT COMMANDS
223 ------------
224
225 We divide git into high level ("porcelain") commands and low level
226 ("plumbing") commands.
227
228 High-level commands (porcelain)
229 -------------------------------
230
231 We separate the porcelain commands into the main commands and some
232 ancillary user utilities.
233
234 Main porcelain commands
235 ~~~~~~~~~~~~~~~~~~~~~~~
236
237 include::cmds-mainporcelain.txt[]
238
239 Ancillary Commands
240 ~~~~~~~~~~~~~~~~~~
241 Manipulators:
242
243 include::cmds-ancillarymanipulators.txt[]
244
245 Interrogators:
246
247 include::cmds-ancillaryinterrogators.txt[]
248
249
250 Interacting with Others
251 ~~~~~~~~~~~~~~~~~~~~~~~
252
253 These commands are to interact with foreign SCM and with other
254 people via patch over e-mail.
255
256 include::cmds-foreignscminterface.txt[]
257
258
259 Low-level commands (plumbing)
260 -----------------------------
261
262 Although git includes its
263 own porcelain layer, its low-level commands are sufficient to support
264 development of alternative porcelains.  Developers of such porcelains
265 might start by reading about linkgit:git-update-index[1] and
266 linkgit:git-read-tree[1].
267
268 The interface (input, output, set of options and the semantics)
269 to these low-level commands are meant to be a lot more stable
270 than Porcelain level commands, because these commands are
271 primarily for scripted use.  The interface to Porcelain commands
272 on the other hand are subject to change in order to improve the
273 end user experience.
274
275 The following description divides
276 the low-level commands into commands that manipulate objects (in
277 the repository, index, and working tree), commands that interrogate and
278 compare objects, and commands that move objects and references between
279 repositories.
280
281
282 Manipulation commands
283 ~~~~~~~~~~~~~~~~~~~~~
284
285 include::cmds-plumbingmanipulators.txt[]
286
287
288 Interrogation commands
289 ~~~~~~~~~~~~~~~~~~~~~~
290
291 include::cmds-plumbinginterrogators.txt[]
292
293 In general, the interrogate commands do not touch the files in
294 the working tree.
295
296
297 Synching repositories
298 ~~~~~~~~~~~~~~~~~~~~~
299
300 include::cmds-synchingrepositories.txt[]
301
302 The following are helper programs used by the above; end users
303 typically do not use them directly.
304
305 include::cmds-synchelpers.txt[]
306
307
308 Internal helper commands
309 ~~~~~~~~~~~~~~~~~~~~~~~~
310
311 These are internal helper commands used by other commands; end
312 users typically do not use them directly.
313
314 include::cmds-purehelpers.txt[]
315
316
317 Configuration Mechanism
318 -----------------------
319
320 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
321 is used to hold per-repository configuration options.  It is a
322 simple text file modeled after `.ini` format familiar to some
323 people.  Here is an example:
324
325 ------------
326 #
327 # A '#' or ';' character indicates a comment.
328 #
329
330 ; core variables
331 [core]
332         ; Don't trust file modes
333         filemode = false
334
335 ; user identity
336 [user]
337         name = "Junio C Hamano"
338         email = "junkio@twinsun.com"
339
340 ------------
341
342 Various commands read from the configuration file and adjust
343 their operation accordingly.
344
345
346 Identifier Terminology
347 ----------------------
348 <object>::
349         Indicates the object name for any type of object.
350
351 <blob>::
352         Indicates a blob object name.
353
354 <tree>::
355         Indicates a tree object name.
356
357 <commit>::
358         Indicates a commit object name.
359
360 <tree-ish>::
361         Indicates a tree, commit or tag object name.  A
362         command that takes a <tree-ish> argument ultimately wants to
363         operate on a <tree> object but automatically dereferences
364         <commit> and <tag> objects that point at a <tree>.
365
366 <commit-ish>::
367         Indicates a commit or tag object name.  A
368         command that takes a <commit-ish> argument ultimately wants to
369         operate on a <commit> object but automatically dereferences
370         <tag> objects that point at a <commit>.
371
372 <type>::
373         Indicates that an object type is required.
374         Currently one of: `blob`, `tree`, `commit`, or `tag`.
375
376 <file>::
377         Indicates a filename - almost always relative to the
378         root of the tree structure `GIT_INDEX_FILE` describes.
379
380 Symbolic Identifiers
381 --------------------
382 Any git command accepting any <object> can also use the following
383 symbolic notation:
384
385 HEAD::
386         indicates the head of the current branch (i.e. the
387         contents of `$GIT_DIR/HEAD`).
388
389 <tag>::
390         a valid tag 'name'
391         (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
392
393 <head>::
394         a valid head 'name'
395         (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
396
397 For a more complete list of ways to spell object names, see
398 "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
399
400
401 File/Directory Structure
402 ------------------------
403
404 Please see the linkgit:gitrepository-layout[5] document.
405
406 Read linkgit:githooks[5] for more details about each hook.
407
408 Higher level SCMs may provide and manage additional information in the
409 `$GIT_DIR`.
410
411
412 Terminology
413 -----------
414 Please see linkgit:gitglossary[7].
415
416
417 Environment Variables
418 ---------------------
419 Various git commands use the following environment variables:
420
421 The git Repository
422 ~~~~~~~~~~~~~~~~~~
423 These environment variables apply to 'all' core git commands. Nb: it
424 is worth noting that they may be used/overridden by SCMS sitting above
425 git so take care if using Cogito etc.
426
427 'GIT_INDEX_FILE'::
428         This environment allows the specification of an alternate
429         index file. If not specified, the default of `$GIT_DIR/index`
430         is used.
431
432 'GIT_OBJECT_DIRECTORY'::
433         If the object storage directory is specified via this
434         environment variable then the sha1 directories are created
435         underneath - otherwise the default `$GIT_DIR/objects`
436         directory is used.
437
438 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
439         Due to the immutable nature of git objects, old objects can be
440         archived into shared, read-only directories. This variable
441         specifies a ":" separated (on Windows ";" separated) list
442         of git object directories which can be used to search for git
443         objects. New objects will not be written to these directories.
444
445 'GIT_DIR'::
446         If the 'GIT_DIR' environment variable is set then it
447         specifies a path to use instead of the default `.git`
448         for the base of the repository.
449
450 'GIT_WORK_TREE'::
451         Set the path to the working tree.  The value will not be
452         used in combination with repositories found automatically in
453         a .git directory (i.e. $GIT_DIR is not set).
454         This can also be controlled by the '--work-tree' command line
455         option and the core.worktree configuration variable.
456
457 'GIT_CEILING_DIRECTORIES'::
458         This should be a colon-separated list of absolute paths.
459         If set, it is a list of directories that git should not chdir
460         up into while looking for a repository directory.
461         It will not exclude the current working directory or
462         a GIT_DIR set on the command line or in the environment.
463         (Useful for excluding slow-loading network directories.)
464
465 git Commits
466 ~~~~~~~~~~~
467 'GIT_AUTHOR_NAME'::
468 'GIT_AUTHOR_EMAIL'::
469 'GIT_AUTHOR_DATE'::
470 'GIT_COMMITTER_NAME'::
471 'GIT_COMMITTER_EMAIL'::
472 'GIT_COMMITTER_DATE'::
473 'EMAIL'::
474         see linkgit:git-commit-tree[1]
475
476 git Diffs
477 ~~~~~~~~~
478 'GIT_DIFF_OPTS'::
479         Only valid setting is "--unified=??" or "-u??" to set the
480         number of context lines shown when a unified diff is created.
481         This takes precedence over any "-U" or "--unified" option
482         value passed on the git diff command line.
483
484 'GIT_EXTERNAL_DIFF'::
485         When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
486         program named by it is called, instead of the diff invocation
487         described above.  For a path that is added, removed, or modified,
488         'GIT_EXTERNAL_DIFF' is called with 7 parameters:
489
490         path old-file old-hex old-mode new-file new-hex new-mode
491 +
492 where:
493
494         <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
495                          contents of <old|new>,
496         <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
497         <old|new>-mode:: are the octal representation of the file modes.
498
499 +
500 The file parameters can point at the user's working file
501 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
502 when a new file is added), or a temporary file (e.g. `old-file` in the
503 index).  'GIT_EXTERNAL_DIFF' should not worry about unlinking the
504 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
505 +
506 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
507 parameter, <path>.
508
509 other
510 ~~~~~
511 'GIT_MERGE_VERBOSITY'::
512         A number controlling the amount of output shown by
513         the recursive merge strategy.  Overrides merge.verbosity.
514         See linkgit:git-merge[1]
515
516 'GIT_PAGER'::
517         This environment variable overrides `$PAGER`. If it is set
518         to an empty string or to the value "cat", git will not launch
519         a pager.  See also the `core.pager` option in
520         linkgit:git-config[1].
521
522 'GIT_SSH'::
523         If this environment variable is set then 'git-fetch'
524         and 'git-push' will use this command instead
525         of 'ssh' when they need to connect to a remote system.
526         The '$GIT_SSH' command will be given exactly two arguments:
527         the 'username@host' (or just 'host') from the URL and the
528         shell command to execute on that remote system.
529 +
530 To pass options to the program that you want to list in GIT_SSH
531 you will need to wrap the program and options into a shell script,
532 then set GIT_SSH to refer to the shell script.
533 +
534 Usually it is easier to configure any desired options through your
535 personal `.ssh/config` file.  Please consult your ssh documentation
536 for further details.
537
538 'GIT_FLUSH'::
539         If this environment variable is set to "1", then commands such
540         as 'git-blame' (in incremental mode), 'git-rev-list', 'git-log',
541         and 'git-whatchanged' will force a flush of the output stream
542         after each commit-oriented record have been flushed.   If this
543         variable is set to "0", the output of these commands will be done
544         using completely buffered I/O.   If this environment variable is
545         not set, git will choose buffered or record-oriented flushing
546         based on whether stdout appears to be redirected to a file or not.
547
548 'GIT_TRACE'::
549         If this variable is set to "1", "2" or "true" (comparison
550         is case insensitive), git will print `trace:` messages on
551         stderr telling about alias expansion, built-in command
552         execution and external command execution.
553         If this variable is set to an integer value greater than 1
554         and lower than 10 (strictly) then git will interpret this
555         value as an open file descriptor and will try to write the
556         trace messages into this file descriptor.
557         Alternatively, if this variable is set to an absolute path
558         (starting with a '/' character), git will interpret this
559         as a file path and will try to write the trace messages
560         into it.
561
562 Discussion[[Discussion]]
563 ------------------------
564
565 More detail on the following is available from the
566 link:user-manual.html#git-concepts[git concepts chapter of the
567 user-manual] and linkgit:gitcore-tutorial[7].
568
569 A git project normally consists of a working directory with a ".git"
570 subdirectory at the top level.  The .git directory contains, among other
571 things, a compressed object database representing the complete history
572 of the project, an "index" file which links that history to the current
573 contents of the working tree, and named pointers into that history such
574 as tags and branch heads.
575
576 The object database contains objects of three main types: blobs, which
577 hold file data; trees, which point to blobs and other trees to build up
578 directory hierarchies; and commits, which each reference a single tree
579 and some number of parent commits.
580
581 The commit, equivalent to what other systems call a "changeset" or
582 "version", represents a step in the project's history, and each parent
583 represents an immediately preceding step.  Commits with more than one
584 parent represent merges of independent lines of development.
585
586 All objects are named by the SHA1 hash of their contents, normally
587 written as a string of 40 hex digits.  Such names are globally unique.
588 The entire history leading up to a commit can be vouched for by signing
589 just that commit.  A fourth object type, the tag, is provided for this
590 purpose.
591
592 When first created, objects are stored in individual files, but for
593 efficiency may later be compressed together into "pack files".
594
595 Named pointers called refs mark interesting points in history.  A ref
596 may contain the SHA1 name of an object or the name of another ref.  Refs
597 with names beginning `ref/head/` contain the SHA1 name of the most
598 recent commit (or "head") of a branch under development.  SHA1 names of
599 tags of interest are stored under `ref/tags/`.  A special ref named
600 `HEAD` contains the name of the currently checked-out branch.
601
602 The index file is initialized with a list of all paths and, for each
603 path, a blob object and a set of attributes.  The blob object represents
604 the contents of the file as of the head of the current branch.  The
605 attributes (last modified time, size, etc.) are taken from the
606 corresponding file in the working tree.  Subsequent changes to the
607 working tree can be found by comparing these attributes.  The index may
608 be updated with new content, and new commits may be created from the
609 content stored in the index.
610
611 The index is also capable of storing multiple entries (called "stages")
612 for a given pathname.  These stages are used to hold the various
613 unmerged version of a file when a merge is in progress.
614
615 Authors
616 -------
617 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
618 * The current git nurse is Junio C Hamano <gitster@pobox.com>.
619 * The git potty was written by Andreas Ericsson <ae@op5.se>.
620 * General upbringing is handled by the git-list <git@vger.kernel.org>.
621
622 Documentation
623 --------------
624 The documentation for git suite was started by David Greaves
625 <david@dgreaves.com>, and later enhanced greatly by the
626 contributors on the git-list <git@vger.kernel.org>.
627
628 SEE ALSO
629 --------
630 linkgit:gittutorial[7], linkgit:gittutorial-2[7],
631 link:everyday.html[Everyday Git], linkgit:gitcvs-migration[7],
632 linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
633 linkgit:gitcli[7], link:user-manual.html[The Git User's Manual]
634
635 GIT
636 ---
637 Part of the linkgit:git[1] suite