blob: 157ef29131ebcdbd60f81507681e68ac84ce307c [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git(7)
2======
3
4NAME
5----
6git - the stupid content tracker
7
8
9SYNOPSIS
10--------
Junio C Hamano6b2cee12006-08-26 08:43:3111[verse]
Junio C Hamanof870ef82006-07-29 09:10:1312'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
Junio C Hamano6b2cee12006-08-26 08:43:3113 [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]
Junio C Hamano1a4e8412005-12-27 08:17:2314
15DESCRIPTION
16-----------
Junio C Hamanoe27fb932006-04-03 05:34:1017Git is a fast, scalable, distributed revision control system with an
18unusually rich command set that provides both high-level operations
19and full access to internals.
20
21See this link:tutorial.html[tutorial] to get started, then see
22link:everyday.html[Everyday Git] for a useful minimum set of commands, and
23"man git-commandname" for documentation of each command. CVS users may
Junio C Hamano3d30fd52007-05-08 00:32:5324also want to read link:cvs-migration.html[CVS migration]. See
25link:user-manual.html[Git User's Manual] for a more in-depth
26introduction.
Junio C Hamano1a4e8412005-12-27 08:17:2327
Junio C Hamano33db4372006-06-07 19:51:4528The COMMAND is either a name of a Git command (see below) or an alias
Junio C Hamano7ad22dc2007-01-29 02:55:4829as defined in the configuration file (see gitlink:git-config[1]).
Junio C Hamano33db4372006-06-07 19:51:4530
Junio C Hamanob63afff2007-05-01 03:05:5531Formatted and hyperlinked version of the latest git
32documentation can be viewed at
33`http://www.kernel.org/pub/software/scm/git/docs/`.
34
Junio C Hamano9d52e572007-02-13 23:48:2035ifdef::stalenotes[]
36[NOTE]
37============
Junio C Hamano9d52e572007-02-13 23:48:2038
Junio C Hamanoa9b8d242007-05-19 04:51:5539You are reading the documentation for the latest (possibly
40unreleased) version of git, that is available from 'master'
41branch of the `git.git` repository.
42Documentation for older releases are available here:
Junio C Hamano2fc92602007-03-29 01:09:4643
Junio C Hamano75485c82007-05-19 04:20:3344* link:v1.5.1.5/git.html[documentation for release 1.5.1.5]
45
Junio C Hamanoa9b8d242007-05-19 04:51:5546* release notes for link:RelNotes-1.5.1.5.txt[1.5.1.5],
47 link:RelNotes-1.5.1.4.txt[1.5.1.4],
48 link:RelNotes-1.5.1.3.txt[1.5.1.3],
49 link:RelNotes-1.5.1.2.txt[1.5.1.2],
50 link:RelNotes-1.5.1.1.txt[1.5.1.1],
51 link:RelNotes-1.5.1.txt[1.5.1].
Junio C Hamano91d44c52007-05-09 07:16:0752
Junio C Hamanoa9b8d242007-05-19 04:51:5553* link:v1.5.0.7/git.html[documentation for release 1.5.0.7]
Junio C Hamano91d44c52007-05-09 07:16:0754
Junio C Hamanoa9b8d242007-05-19 04:51:5555* release notes for link:RelNotes-1.5.0.7.txt[1.5.0.7],
56 link:RelNotes-1.5.0.6.txt[1.5.0.6],
57 link:RelNotes-1.5.0.5.txt[1.5.0.5],
58 link:RelNotes-1.5.0.3.txt[1.5.0.3],
59 link:RelNotes-1.5.0.2.txt[1.5.0.2],
60 link:RelNotes-1.5.0.1.txt[1.5.0.1],
61 link:RelNotes-1.5.0.txt[1.5.0].
Junio C Hamanoe90436a2007-04-22 07:22:1362
Junio C Hamanoa9b8d242007-05-19 04:51:5563* documentation for release link:v1.4.4.4/git.html[1.4.4.4],
64 link:v1.3.3/git.html[1.3.3],
65 link:v1.2.6/git.html[1.2.6],
66 link:v1.0.13/git.html[1.0.13].
Junio C Hamano9d52e572007-02-13 23:48:2067
68============
69
70endif::stalenotes[]
71
Junio C Hamano1a4e8412005-12-27 08:17:2372OPTIONS
73-------
74--version::
Junio C Hamano01078922006-03-10 00:31:4775Prints the git suite version that the 'git' program came from.
Junio C Hamano1a4e8412005-12-27 08:17:2376
77--help::
Junio C Hamano01078922006-03-10 00:31:4778Prints the synopsis and a list of the most commonly used
79commands. If a git command is named this option will bring up
80the man-page for that command. If the option '--all' or '-a' is
81given then all available commands are printed.
Junio C Hamano1a4e8412005-12-27 08:17:2382
83--exec-path::
Junio C Hamano01078922006-03-10 00:31:4784Path to wherever your core git programs are installed.
Junio C Hamano1a4e8412005-12-27 08:17:2385This can also be controlled by setting the GIT_EXEC_PATH
86environment variable. If no path is given 'git' will print
87the current setting and then exit.
88
Junio C Hamanof870ef82006-07-29 09:10:1389-p|--paginate::
90Pipe all output into 'less' (or if set, $PAGER).
91
92--git-dir=<path>::
93Set the path to the repository. This can also be controlled by
94setting the GIT_DIR environment variable.
95
96--bare::
97Same as --git-dir=`pwd`.
Junio C Hamano1a4e8412005-12-27 08:17:2398
Junio C Hamanoe27fb932006-04-03 05:34:1099FURTHER DOCUMENTATION
100---------------------
Junio C Hamano1a4e8412005-12-27 08:17:23101
Junio C Hamanoe27fb932006-04-03 05:34:10102See the references above to get started using git. The following is
103probably more detail than necessary for a first-time user.
Junio C Hamano1a4e8412005-12-27 08:17:23104
Junio C Hamanoe27fb932006-04-03 05:34:10105The <<Discussion,Discussion>> section below and the
106link:core-tutorial.html[Core tutorial] both provide introductions to the
107underlying git architecture.
Junio C Hamano1a4e8412005-12-27 08:17:23108
Junio C Hamanoe27fb932006-04-03 05:34:10109See also the link:howto-index.html[howto] documents for some useful
110examples.
Junio C Hamano1a4e8412005-12-27 08:17:23111
Junio C Hamanoe27fb932006-04-03 05:34:10112GIT COMMANDS
113------------
Junio C Hamano1a4e8412005-12-27 08:17:23114
Junio C Hamanoe27fb932006-04-03 05:34:10115We divide git into high level ("porcelain") commands and low level
116("plumbing") commands.
Junio C Hamano1a4e8412005-12-27 08:17:23117
Junio C Hamanob19b4f02006-10-29 20:47:22118High-level commands (porcelain)
119-------------------------------
120
121We separate the porcelain commands into the main commands and some
122ancillary user utilities.
123
124Main porcelain commands
125~~~~~~~~~~~~~~~~~~~~~~~
126
Junio C Hamano7c73c662007-01-19 00:37:50127include::cmds-mainporcelain.txt[]
Junio C Hamanob19b4f02006-10-29 20:47:22128
129Ancillary Commands
130~~~~~~~~~~~~~~~~~~
131Manipulators:
132
Junio C Hamano7c73c662007-01-19 00:37:50133include::cmds-ancillarymanipulators.txt[]
Junio C Hamanob19b4f02006-10-29 20:47:22134
135Interrogators:
136
Junio C Hamano7c73c662007-01-19 00:37:50137include::cmds-ancillaryinterrogators.txt[]
Junio C Hamanob19b4f02006-10-29 20:47:22138
Junio C Hamano4ad294b2007-01-20 02:22:50139
140Interacting with Others
141~~~~~~~~~~~~~~~~~~~~~~~
142
143These commands are to interact with foreign SCM and with other
144people via patch over e-mail.
145
146include::cmds-foreignscminterface.txt[]
147
148
Junio C Hamanoe27fb932006-04-03 05:34:10149Low-level commands (plumbing)
150-----------------------------
Junio C Hamano1a4e8412005-12-27 08:17:23151
Junio C Hamanoe27fb932006-04-03 05:34:10152Although git includes its
153own porcelain layer, its low-level commands are sufficient to support
154development of alternative porcelains. Developers of such porcelains
155might start by reading about gitlink:git-update-index[1] and
156gitlink:git-read-tree[1].
Junio C Hamano1a4e8412005-12-27 08:17:23157
Junio C Hamano4ad294b2007-01-20 02:22:50158The interface (input, output, set of options and the semantics)
159to these low-level commands are meant to be a lot more stable
160than Porcelain level commands, because these commands are
161primarily for scripted use. The interface to Porcelain commands
162on the other hand are subject to change in order to improve the
163end user experience.
164
165The following description divides
166the low-level commands into commands that manipulate objects (in
Junio C Hamanoe27fb932006-04-03 05:34:10167the repository, index, and working tree), commands that interrogate and
168compare objects, and commands that move objects and references between
169repositories.
Junio C Hamano1a4e8412005-12-27 08:17:23170
Junio C Hamano4ad294b2007-01-20 02:22:50171
Junio C Hamano1a4e8412005-12-27 08:17:23172Manipulation commands
173~~~~~~~~~~~~~~~~~~~~~
Junio C Hamano1a4e8412005-12-27 08:17:23174
Junio C Hamano7c73c662007-01-19 00:37:50175include::cmds-plumbingmanipulators.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:23176
177
178Interrogation commands
179~~~~~~~~~~~~~~~~~~~~~~
180
Junio C Hamano7c73c662007-01-19 00:37:50181include::cmds-plumbinginterrogators.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:23182
183In general, the interrogate commands do not touch the files in
184the working tree.
185
186
187Synching repositories
188~~~~~~~~~~~~~~~~~~~~~
189
Junio C Hamano7c73c662007-01-19 00:37:50190include::cmds-synchingrepositories.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:23191
Junio C Hamano4ad294b2007-01-20 02:22:50192The following are helper programs used by the above; end users
193typically do not use them directly.
194
195include::cmds-synchelpers.txt[]
196
197
198Internal helper commands
199~~~~~~~~~~~~~~~~~~~~~~~~
200
201These are internal helper commands used by other commands; end
202users typically do not use them directly.
203
204include::cmds-purehelpers.txt[]
205
Junio C Hamano1a4e8412005-12-27 08:17:23206
Junio C Hamano1a4e8412005-12-27 08:17:23207Configuration Mechanism
208-----------------------
209
210Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
211is used to hold per-repository configuration options. It is a
Junio C Hamano51c2ab02006-07-09 20:38:54212simple text file modeled after `.ini` format familiar to some
Junio C Hamano1a4e8412005-12-27 08:17:23213people. Here is an example:
214
215------------
216#
217# A '#' or ';' character indicates a comment.
218#
219
220; core variables
221[core]
222; Don't trust file modes
223filemode = false
224
225; user identity
226[user]
227name = "Junio C Hamano"
228email = "junkio@twinsun.com"
229
230------------
231
232Various commands read from the configuration file and adjust
233their operation accordingly.
234
235
236Identifier Terminology
237----------------------
238<object>::
239Indicates the object name for any type of object.
240
241<blob>::
242Indicates a blob object name.
243
244<tree>::
245Indicates a tree object name.
246
247<commit>::
248Indicates a commit object name.
249
250<tree-ish>::
251Indicates a tree, commit or tag object name. A
252command that takes a <tree-ish> argument ultimately wants to
253operate on a <tree> object but automatically dereferences
254<commit> and <tag> objects that point at a <tree>.
255
Junio C Hamano60f8aa82007-03-06 09:58:26256<commit-ish>::
257Indicates a commit or tag object name. A
258command that takes a <commit-ish> argument ultimately wants to
259operate on a <commit> object but automatically dereferences
260<tag> objects that point at a <commit>.
261
Junio C Hamano1a4e8412005-12-27 08:17:23262<type>::
263Indicates that an object type is required.
264Currently one of: `blob`, `tree`, `commit`, or `tag`.
265
266<file>::
267Indicates a filename - almost always relative to the
268root of the tree structure `GIT_INDEX_FILE` describes.
269
270Symbolic Identifiers
271--------------------
272Any git command accepting any <object> can also use the following
273symbolic notation:
274
275HEAD::
276indicates the head of the current branch (i.e. the
277contents of `$GIT_DIR/HEAD`).
278
279<tag>::
280a valid tag 'name'
281(i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
282
283<head>::
284a valid head 'name'
285(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
286
Junio C Hamanoff4b4312006-10-25 22:55:31287For a more complete list of ways to spell object names, see
288"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
289
Junio C Hamano1a4e8412005-12-27 08:17:23290
291File/Directory Structure
292------------------------
293
294Please see link:repository-layout.html[repository layout] document.
295
Junio C Hamano818f7d62006-03-26 01:49:30296Read link:hooks.html[hooks] for more details about each hook.
297
Junio C Hamano1a4e8412005-12-27 08:17:23298Higher level SCMs may provide and manage additional information in the
299`$GIT_DIR`.
300
301
302Terminology
303-----------
304Please see link:glossary.html[glossary] document.
305
306
307Environment Variables
308---------------------
309Various git commands use the following environment variables:
310
311The git Repository
312~~~~~~~~~~~~~~~~~~
313These environment variables apply to 'all' core git commands. Nb: it
314is worth noting that they may be used/overridden by SCMS sitting above
315git so take care if using Cogito etc.
316
317'GIT_INDEX_FILE'::
318This environment allows the specification of an alternate
319index file. If not specified, the default of `$GIT_DIR/index`
320is used.
321
322'GIT_OBJECT_DIRECTORY'::
323If the object storage directory is specified via this
324environment variable then the sha1 directories are created
325underneath - otherwise the default `$GIT_DIR/objects`
326directory is used.
327
328'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
329Due to the immutable nature of git objects, old objects can be
330archived into shared, read-only directories. This variable
331specifies a ":" separated list of git object directories which
332can be used to search for git objects. New objects will not be
333written to these directories.
334
335'GIT_DIR'::
336If the 'GIT_DIR' environment variable is set then it
337specifies a path to use instead of the default `.git`
338for the base of the repository.
339
340git Commits
341~~~~~~~~~~~
342'GIT_AUTHOR_NAME'::
343'GIT_AUTHOR_EMAIL'::
344'GIT_AUTHOR_DATE'::
345'GIT_COMMITTER_NAME'::
346'GIT_COMMITTER_EMAIL'::
Junio C Hamano469d60e2007-04-29 18:30:34347'GIT_COMMITTER_DATE'::
348'EMAIL'::
Junio C Hamano1a4e8412005-12-27 08:17:23349see gitlink:git-commit-tree[1]
350
351git Diffs
352~~~~~~~~~
353'GIT_DIFF_OPTS'::
Junio C Hamano1c437122006-11-28 02:22:25354Only valid setting is "--unified=??" or "-u??" to set the
355number of context lines shown when a unified diff is created.
356This takes precedence over any "-U" or "--unified" option
357value passed on the git diff command line.
358
Junio C Hamano1a4e8412005-12-27 08:17:23359'GIT_EXTERNAL_DIFF'::
Junio C Hamano1c437122006-11-28 02:22:25360When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
361program named by it is called, instead of the diff invocation
362described above. For a path that is added, removed, or modified,
363 'GIT_EXTERNAL_DIFF' is called with 7 parameters:
364
365path old-file old-hex old-mode new-file new-hex new-mode
366+
367where:
368
369<old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
370 contents of <old|new>,
371<old|new>-hex:: are the 40-hexdigit SHA1 hashes,
372<old|new>-mode:: are the octal representation of the file modes.
373
374+
375The file parameters can point at the user's working file
376(e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
377when a new file is added), or a temporary file (e.g. `old-file` in the
378index). 'GIT_EXTERNAL_DIFF' should not worry about unlinking the
379temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
380+
381For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
382parameter, <path>.
Junio C Hamano1a4e8412005-12-27 08:17:23383
Junio C Hamano7ccb9fd2006-07-15 01:38:40384other
385~~~~~
Junio C Hamano85e45fa2006-08-13 07:47:41386'GIT_PAGER'::
387This environment variable overrides `$PAGER`.
388
Junio C Hamano7ccb9fd2006-07-15 01:38:40389'GIT_TRACE'::
Junio C Hamanoef4b48b2006-09-04 10:08:34390If this variable is set to "1", "2" or "true" (comparison
391is case insensitive), git will print `trace:` messages on
Junio C Hamano7ccb9fd2006-07-15 01:38:40392stderr telling about alias expansion, built-in command
393execution and external command execution.
Junio C Hamanoef4b48b2006-09-04 10:08:34394If this variable is set to an integer value greater than 1
395and lower than 10 (strictly) then git will interpret this
396value as an open file descriptor and will try to write the
397trace messages into this file descriptor.
398Alternatively, if this variable is set to an absolute path
399(starting with a '/' character), git will interpret this
400as a file path and will try to write the trace messages
401into it.
Junio C Hamano7ccb9fd2006-07-15 01:38:40402
Junio C Hamano1a4e8412005-12-27 08:17:23403Discussion[[Discussion]]
404------------------------
Junio C Hamano4f9a6052007-01-17 20:25:16405include::core-intro.txt[]
Junio C Hamano1a4e8412005-12-27 08:17:23406
407Authors
408-------
409* git's founding father is Linus Torvalds <torvalds@osdl.org>.
410* The current git nurse is Junio C Hamano <junkio@cox.net>.
411* The git potty was written by Andres Ericsson <ae@op5.se>.
412* General upbringing is handled by the git-list <git@vger.kernel.org>.
413
414Documentation
415--------------
416The documentation for git suite was started by David Greaves
417<david@dgreaves.com>, and later enhanced greatly by the
418contributors on the git-list <git@vger.kernel.org>.
419
420GIT
421---
422Part of the gitlink:git[7] suite
423