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.4/git.html[documentation for release 1.5.2.4]
48 link:RelNotes-1.5.2.4.txt[1.5.2.4],
49 link:RelNotes-1.5.2.3.txt[1.5.2.3],
50 link:RelNotes-1.5.2.2.txt[1.5.2.2],
51 link:RelNotes-1.5.2.1.txt[1.5.2.1],
52 link:RelNotes-1.5.2.txt[1.5.2].
54 * link:v1.5.1.6/git.html[documentation for release 1.5.1.6]
57 link:RelNotes-1.5.1.6.txt[1.5.1.6],
58 link:RelNotes-1.5.1.5.txt[1.5.1.5],
59 link:RelNotes-1.5.1.4.txt[1.5.1.4],
60 link:RelNotes-1.5.1.3.txt[1.5.1.3],
61 link:RelNotes-1.5.1.2.txt[1.5.1.2],
62 link:RelNotes-1.5.1.1.txt[1.5.1.1],
63 link:RelNotes-1.5.1.txt[1.5.1].
65 * link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
68 link:RelNotes-1.5.0.7.txt[1.5.0.7],
69 link:RelNotes-1.5.0.6.txt[1.5.0.6],
70 link:RelNotes-1.5.0.5.txt[1.5.0.5],
71 link:RelNotes-1.5.0.3.txt[1.5.0.3],
72 link:RelNotes-1.5.0.2.txt[1.5.0.2],
73 link:RelNotes-1.5.0.1.txt[1.5.0.1],
74 link:RelNotes-1.5.0.txt[1.5.0].
76 * documentation for release link:v1.4.4.4/git.html[1.4.4.4],
77 link:v1.3.3/git.html[1.3.3],
78 link:v1.2.6/git.html[1.2.6],
79 link:v1.0.13/git.html[1.0.13].
88 Prints the git suite version that the 'git' program came from.
91 Prints the synopsis and a list of the most commonly used
92 commands. If a git command is named this option will bring up
93 the man-page for that command. If the option '--all' or '-a' is
94 given then all available commands are printed.
97 Path to wherever your core git programs are installed.
98 This can also be controlled by setting the GIT_EXEC_PATH
99 environment variable. If no path is given 'git' will print
100 the current setting and then exit.
103 Pipe all output into 'less' (or if set, $PAGER).
106 Set the path to the repository. This can also be controlled by
107 setting the GIT_DIR environment variable.
110 Set the path to the working tree. The value will not be
111 used in combination with repositories found automatically in
112 a .git directory (i.e. $GIT_DIR is not set).
113 This can also be controlled by setting the GIT_WORK_TREE
114 environment variable and the core.worktree configuration
118 Same as --git-dir=`pwd`.
120 FURTHER DOCUMENTATION
121 ---------------------
123 See the references above to get started using git. The following is
124 probably more detail than necessary for a first-time user.
126 The <<Discussion,Discussion>> section below and the
127 link:core-tutorial.html[Core tutorial] both provide introductions to the
128 underlying git architecture.
130 See also the link:howto-index.html[howto] documents for some useful
136 We divide git into high level ("porcelain") commands and low level
137 ("plumbing") commands.
139 High-level commands (porcelain)
140 -------------------------------
142 We separate the porcelain commands into the main commands and some
143 ancillary user utilities.
145 Main porcelain commands
146 ~~~~~~~~~~~~~~~~~~~~~~~
148 include::cmds-mainporcelain.txt[]
154 include::cmds-ancillarymanipulators.txt[]
158 include::cmds-ancillaryinterrogators.txt[]
161 Interacting with Others
162 ~~~~~~~~~~~~~~~~~~~~~~~
164 These commands are to interact with foreign SCM and with other
165 people via patch over e-mail.
167 include::cmds-foreignscminterface.txt[]
170 Low-level commands (plumbing)
171 -----------------------------
173 Although git includes its
174 own porcelain layer, its low-level commands are sufficient to support
175 development of alternative porcelains. Developers of such porcelains
176 might start by reading about gitlink:git-update-index[1] and
177 gitlink:git-read-tree[1].
179 The interface (input, output, set of options and the semantics)
180 to these low-level commands are meant to be a lot more stable
181 than Porcelain level commands, because these commands are
182 primarily for scripted use. The interface to Porcelain commands
183 on the other hand are subject to change in order to improve the
186 The following description divides
187 the low-level commands into commands that manipulate objects (in
188 the repository, index, and working tree), commands that interrogate and
189 compare objects, and commands that move objects and references between
193 Manipulation commands
194 ~~~~~~~~~~~~~~~~~~~~~
196 include::cmds-plumbingmanipulators.txt[]
199 Interrogation commands
200 ~~~~~~~~~~~~~~~~~~~~~~
202 include::cmds-plumbinginterrogators.txt[]
204 In general, the interrogate commands do not touch the files in
208 Synching repositories
209 ~~~~~~~~~~~~~~~~~~~~~
211 include::cmds-synchingrepositories.txt[]
213 The following are helper programs used by the above; end users
214 typically do not use them directly.
216 include::cmds-synchelpers.txt[]
219 Internal helper commands
220 ~~~~~~~~~~~~~~~~~~~~~~~~
222 These are internal helper commands used by other commands; end
223 users typically do not use them directly.
225 include::cmds-purehelpers.txt[]
228 Configuration Mechanism
229 -----------------------
231 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
232 is used to hold per-repository configuration options. It is a
233 simple text file modeled after `.ini` format familiar to some
234 people. Here is an example:
238 # A '#' or ';' character indicates a comment.
243 ; Don't trust file modes
248 name = "Junio C Hamano"
249 email = "junkio@twinsun.com"
253 Various commands read from the configuration file and adjust
254 their operation accordingly.
257 Identifier Terminology
258 ----------------------
260 Indicates the object name for any type of object.
263 Indicates a blob object name.
266 Indicates a tree object name.
269 Indicates a commit object name.
272 Indicates a tree, commit or tag object name. A
273 command that takes a <tree-ish> argument ultimately wants to
274 operate on a <tree> object but automatically dereferences
275 <commit> and <tag> objects that point at a <tree>.
278 Indicates a commit or tag object name. A
279 command that takes a <commit-ish> argument ultimately wants to
280 operate on a <commit> object but automatically dereferences
281 <tag> objects that point at a <commit>.
284 Indicates that an object type is required.
285 Currently one of: `blob`, `tree`, `commit`, or `tag`.
288 Indicates a filename - almost always relative to the
289 root of the tree structure `GIT_INDEX_FILE` describes.
293 Any git command accepting any <object> can also use the following
297 indicates the head of the current branch (i.e. the
298 contents of `$GIT_DIR/HEAD`).
302 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
306 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
308 For a more complete list of ways to spell object names, see
309 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
312 File/Directory Structure
313 ------------------------
315 Please see link:repository-layout.html[repository layout] document.
317 Read link:hooks.html[hooks] for more details about each hook.
319 Higher level SCMs may provide and manage additional information in the
325 Please see link:glossary.html[glossary] document.
328 Environment Variables
329 ---------------------
330 Various git commands use the following environment variables:
334 These environment variables apply to 'all' core git commands. Nb: it
335 is worth noting that they may be used/overridden by SCMS sitting above
336 git so take care if using Cogito etc.
339 This environment allows the specification of an alternate
340 index file. If not specified, the default of `$GIT_DIR/index`
343 'GIT_OBJECT_DIRECTORY'::
344 If the object storage directory is specified via this
345 environment variable then the sha1 directories are created
346 underneath - otherwise the default `$GIT_DIR/objects`
349 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
350 Due to the immutable nature of git objects, old objects can be
351 archived into shared, read-only directories. This variable
352 specifies a ":" separated list of git object directories which
353 can be used to search for git objects. New objects will not be
354 written to these directories.
357 If the 'GIT_DIR' environment variable is set then it
358 specifies a path to use instead of the default `.git`
359 for the base of the repository.
362 Set the path to the working tree. The value will not be
363 used in combination with repositories found automatically in
364 a .git directory (i.e. $GIT_DIR is not set).
365 This can also be controlled by the '--work-tree' command line
366 option and the core.worktree configuration variable.
373 'GIT_COMMITTER_NAME'::
374 'GIT_COMMITTER_EMAIL'::
375 'GIT_COMMITTER_DATE'::
377 see gitlink:git-commit-tree[1]
382 Only valid setting is "--unified=??" or "-u??" to set the
383 number of context lines shown when a unified diff is created.
384 This takes precedence over any "-U" or "--unified" option
385 value passed on the git diff command line.
387 'GIT_EXTERNAL_DIFF'::
388 When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
389 program named by it is called, instead of the diff invocation
390 described above. For a path that is added, removed, or modified,
391 'GIT_EXTERNAL_DIFF' is called with 7 parameters:
393 path old-file old-hex old-mode new-file new-hex new-mode
397 <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
398 contents of <old|new>,
399 <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
400 <old|new>-mode:: are the octal representation of the file modes.
403 The file parameters can point at the user's working file
404 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
405 when a new file is added), or a temporary file (e.g. `old-file` in the
406 index). 'GIT_EXTERNAL_DIFF' should not worry about unlinking the
407 temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
409 For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
414 'GIT_MERGE_VERBOSITY'::
415 A number controlling the amount of output shown by
416 the recursive merge strategy. Overrides merge.verbosity.
417 See gitlink:git-merge[1]
420 This environment variable overrides `$PAGER`.
423 If this environment variable is set to "1", then commands such
424 as git-blame (in incremental mode), git-rev-list, git-log,
425 git-whatchanged, etc., will force a flush of the output stream
426 after each commit-oriented record have been flushed. If this
427 variable is set to "0", the output of these commands will be done
428 using completely buffered I/O. If this environment variable is
429 not set, git will choose buffered or record-oriented flushing
430 based on whether stdout appears to be redirected to a file or not.
433 If this variable is set to "1", "2" or "true" (comparison
434 is case insensitive), git will print `trace:` messages on
435 stderr telling about alias expansion, built-in command
436 execution and external command execution.
437 If this variable is set to an integer value greater than 1
438 and lower than 10 (strictly) then git will interpret this
439 value as an open file descriptor and will try to write the
440 trace messages into this file descriptor.
441 Alternatively, if this variable is set to an absolute path
442 (starting with a '/' character), git will interpret this
443 as a file path and will try to write the trace messages
446 Discussion[[Discussion]]
447 ------------------------
448 include::core-intro.txt[]
452 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
453 * The current git nurse is Junio C Hamano <junkio@cox.net>.
454 * The git potty was written by Andres Ericsson <ae@op5.se>.
455 * General upbringing is handled by the git-list <git@vger.kernel.org>.
459 The documentation for git suite was started by David Greaves
460 <david@dgreaves.com>, and later enhanced greatly by the
461 contributors on the git-list <git@vger.kernel.org>.
465 Part of the gitlink:git[7] suite