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