6 git - the stupid content tracker
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]
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.
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
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/`.
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:
45 * link:v1.5.2.5/git.html[documentation for release 1.5.2.5]
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].
55 * link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
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].
66 * link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
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].
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].
89 Prints the git suite version that the 'git' program came from.
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.
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.
104 Pipe all output into 'less' (or if set, $PAGER).
107 Set the path to the repository. This can also be controlled by
108 setting the GIT_DIR environment variable.
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
119 Same as --git-dir=`pwd`.
121 FURTHER DOCUMENTATION
122 ---------------------
124 See the references above to get started using git. The following is
125 probably more detail than necessary for a first-time user.
127 The <<Discussion,Discussion>> section below and the
128 link:core-tutorial.html[Core tutorial] both provide introductions to the
129 underlying git architecture.
131 See also the link:howto-index.html[howto] documents for some useful
137 We divide git into high level ("porcelain") commands and low level
138 ("plumbing") commands.
140 High-level commands (porcelain)
141 -------------------------------
143 We separate the porcelain commands into the main commands and some
144 ancillary user utilities.
146 Main porcelain commands
147 ~~~~~~~~~~~~~~~~~~~~~~~
149 include::cmds-mainporcelain.txt[]
155 include::cmds-ancillarymanipulators.txt[]
159 include::cmds-ancillaryinterrogators.txt[]
162 Interacting with Others
163 ~~~~~~~~~~~~~~~~~~~~~~~
165 These commands are to interact with foreign SCM and with other
166 people via patch over e-mail.
168 include::cmds-foreignscminterface.txt[]
171 Low-level commands (plumbing)
172 -----------------------------
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].
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
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
194 Manipulation commands
195 ~~~~~~~~~~~~~~~~~~~~~
197 include::cmds-plumbingmanipulators.txt[]
200 Interrogation commands
201 ~~~~~~~~~~~~~~~~~~~~~~
203 include::cmds-plumbinginterrogators.txt[]
205 In general, the interrogate commands do not touch the files in
209 Synching repositories
210 ~~~~~~~~~~~~~~~~~~~~~
212 include::cmds-synchingrepositories.txt[]
214 The following are helper programs used by the above; end users
215 typically do not use them directly.
217 include::cmds-synchelpers.txt[]
220 Internal helper commands
221 ~~~~~~~~~~~~~~~~~~~~~~~~
223 These are internal helper commands used by other commands; end
224 users typically do not use them directly.
226 include::cmds-purehelpers.txt[]
229 Configuration Mechanism
230 -----------------------
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:
239 # A '#' or ';' character indicates a comment.
244 ; Don't trust file modes
249 name = "Junio C Hamano"
250 email = "junkio@twinsun.com"
254 Various commands read from the configuration file and adjust
255 their operation accordingly.
258 Identifier Terminology
259 ----------------------
261 Indicates the object name for any type of object.
264 Indicates a blob object name.
267 Indicates a tree object name.
270 Indicates a commit object name.
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>.
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>.
285 Indicates that an object type is required.
286 Currently one of: `blob`, `tree`, `commit`, or `tag`.
289 Indicates a filename - almost always relative to the
290 root of the tree structure `GIT_INDEX_FILE` describes.
294 Any git command accepting any <object> can also use the following
298 indicates the head of the current branch (i.e. the
299 contents of `$GIT_DIR/HEAD`).
303 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
307 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
309 For a more complete list of ways to spell object names, see
310 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
313 File/Directory Structure
314 ------------------------
316 Please see link:repository-layout.html[repository layout] document.
318 Read link:hooks.html[hooks] for more details about each hook.
320 Higher level SCMs may provide and manage additional information in the
326 Please see link:glossary.html[glossary] document.
329 Environment Variables
330 ---------------------
331 Various git commands use the following environment variables:
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.
340 This environment allows the specification of an alternate
341 index file. If not specified, the default of `$GIT_DIR/index`
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`
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.
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.
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.
374 'GIT_COMMITTER_NAME'::
375 'GIT_COMMITTER_EMAIL'::
376 'GIT_COMMITTER_DATE'::
378 see gitlink:git-commit-tree[1]
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.
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:
394 path old-file old-hex old-mode new-file new-hex new-mode
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.
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.
410 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
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]
421 This environment variable overrides `$PAGER`. If it is set
422 to an empty string or to the value "cat", git will not launch
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.
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.
437 Usually it is easier to configure any desired options through your
438 personal `.ssh/config` file. Please consult your ssh documentation
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.
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
465 Discussion[[Discussion]]
466 ------------------------
467 include::core-intro.txt[]
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>.
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>.
484 Part of the gitlink:git[7] suite