]>
Commit | Line | Data |
---|---|---|
7984eabe | 1 | git(7) |
2cf565c5 | 2 | ====== |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
6 | git - the stupid content tracker | |
7 | ||
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
8b70004b | 11 | [verse] |
6acbcb92 | 12 | 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] |
892c41b9 ML |
13 | [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] |
14 | [--help] COMMAND [ARGS] | |
2cf565c5 DG |
15 | |
16 | DESCRIPTION | |
17 | ----------- | |
23091e95 BF |
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. | |
21 | ||
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 | |
a1dc34fa BF |
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 | |
27 | introduction. | |
cb22bc44 | 28 | |
4514ad4f | 29 | The COMMAND is either a name of a Git command (see below) or an alias |
e0d10e1c | 30 | as defined in the configuration file (see gitlink:git-config[1]). |
4514ad4f | 31 | |
34b604af JA |
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/`. | |
35 | ||
26cfcfbf JH |
36 | ifdef::stalenotes[] |
37 | [NOTE] | |
38 | ============ | |
26cfcfbf | 39 | |
2ff3f61a JH |
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: | |
43a8e4fe | 44 | |
444649e5 | 45 | * link:v1.5.2.3/git.html[documentation for release 1.5.2.3] |
b6e4db6a | 46 | |
aba170cd | 47 | * release notes for |
444649e5 | 48 | link:RelNotes-1.5.2.3.txt[1.5.2.3], |
3e48af38 JH |
49 | link:RelNotes-1.5.2.2.txt[1.5.2.2], |
50 | link:RelNotes-1.5.2.1.txt[1.5.2.1], | |
aba170cd JH |
51 | link:RelNotes-1.5.2.txt[1.5.2]. |
52 | ||
53 | * link:v1.5.1.6/git.html[documentation for release 1.5.1.6] | |
54 | ||
55 | * release notes for | |
56 | link:RelNotes-1.5.1.6.txt[1.5.1.6], | |
57 | link:RelNotes-1.5.1.5.txt[1.5.1.5], | |
2ff3f61a JH |
58 | link:RelNotes-1.5.1.4.txt[1.5.1.4], |
59 | link:RelNotes-1.5.1.3.txt[1.5.1.3], | |
60 | link:RelNotes-1.5.1.2.txt[1.5.1.2], | |
61 | link:RelNotes-1.5.1.1.txt[1.5.1.1], | |
62 | link:RelNotes-1.5.1.txt[1.5.1]. | |
63 | ||
64 | * link:v1.5.0.7/git.html[documentation for release 1.5.0.7] | |
65 | ||
aba170cd JH |
66 | * release notes for |
67 | link:RelNotes-1.5.0.7.txt[1.5.0.7], | |
2ff3f61a JH |
68 | link:RelNotes-1.5.0.6.txt[1.5.0.6], |
69 | link:RelNotes-1.5.0.5.txt[1.5.0.5], | |
70 | link:RelNotes-1.5.0.3.txt[1.5.0.3], | |
71 | link:RelNotes-1.5.0.2.txt[1.5.0.2], | |
72 | link:RelNotes-1.5.0.1.txt[1.5.0.1], | |
73 | link:RelNotes-1.5.0.txt[1.5.0]. | |
74 | ||
75 | * documentation for release link:v1.4.4.4/git.html[1.4.4.4], | |
76 | link:v1.3.3/git.html[1.3.3], | |
77 | link:v1.2.6/git.html[1.2.6], | |
78 | link:v1.0.13/git.html[1.0.13]. | |
26cfcfbf JH |
79 | |
80 | ============ | |
81 | ||
82 | endif::stalenotes[] | |
83 | ||
cb22bc44 AE |
84 | OPTIONS |
85 | ------- | |
86 | --version:: | |
a87cd02c | 87 | Prints the git suite version that the 'git' program came from. |
cb22bc44 AE |
88 | |
89 | --help:: | |
a87cd02c FK |
90 | Prints the synopsis and a list of the most commonly used |
91 | commands. If a git command is named this option will bring up | |
92 | the man-page for that command. If the option '--all' or '-a' is | |
93 | given then all available commands are printed. | |
cb22bc44 AE |
94 | |
95 | --exec-path:: | |
a87cd02c | 96 | Path to wherever your core git programs are installed. |
cb22bc44 AE |
97 | This can also be controlled by setting the GIT_EXEC_PATH |
98 | environment variable. If no path is given 'git' will print | |
99 | the current setting and then exit. | |
100 | ||
6acbcb92 JS |
101 | -p|--paginate:: |
102 | Pipe all output into 'less' (or if set, $PAGER). | |
103 | ||
104 | --git-dir=<path>:: | |
105 | Set the path to the repository. This can also be controlled by | |
106 | setting the GIT_DIR environment variable. | |
107 | ||
892c41b9 ML |
108 | --work-tree=<path>:: |
109 | Set the path to the working tree. The value will not be | |
110 | used in combination with repositories found automatically in | |
111 | a .git directory (i.e. $GIT_DIR is not set). | |
112 | This can also be controlled by setting the GIT_WORK_TREE | |
113 | environment variable and the core.worktree configuration | |
114 | variable. | |
115 | ||
6acbcb92 JS |
116 | --bare:: |
117 | Same as --git-dir=`pwd`. | |
9755afbd | 118 | |
23091e95 BF |
119 | FURTHER DOCUMENTATION |
120 | --------------------- | |
9755afbd | 121 | |
23091e95 BF |
122 | See the references above to get started using git. The following is |
123 | probably more detail than necessary for a first-time user. | |
8db9307c | 124 | |
23091e95 BF |
125 | The <<Discussion,Discussion>> section below and the |
126 | link:core-tutorial.html[Core tutorial] both provide introductions to the | |
127 | underlying git architecture. | |
e6fc2346 | 128 | |
23091e95 BF |
129 | See also the link:howto-index.html[howto] documents for some useful |
130 | examples. | |
9755afbd | 131 | |
23091e95 BF |
132 | GIT COMMANDS |
133 | ------------ | |
9755afbd | 134 | |
23091e95 BF |
135 | We divide git into high level ("porcelain") commands and low level |
136 | ("plumbing") commands. | |
8b15e2fb | 137 | |
23091e95 BF |
138 | High-level commands (porcelain) |
139 | ------------------------------- | |
140 | ||
141 | We separate the porcelain commands into the main commands and some | |
142 | ancillary user utilities. | |
143 | ||
144 | Main porcelain commands | |
145 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
905197de | 146 | |
377e8139 | 147 | include::cmds-mainporcelain.txt[] |
e31bb3bb | 148 | |
90933efb | 149 | Ancillary Commands |
23091e95 | 150 | ~~~~~~~~~~~~~~~~~~ |
2f2de9b4 JH |
151 | Manipulators: |
152 | ||
377e8139 | 153 | include::cmds-ancillarymanipulators.txt[] |
204ee6a9 | 154 | |
90933efb | 155 | Interrogators: |
204ee6a9 | 156 | |
377e8139 | 157 | include::cmds-ancillaryinterrogators.txt[] |
7fc9d69f | 158 | |
89bf2077 JH |
159 | |
160 | Interacting with Others | |
161 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
162 | ||
163 | These commands are to interact with foreign SCM and with other | |
164 | people via patch over e-mail. | |
165 | ||
166 | include::cmds-foreignscminterface.txt[] | |
167 | ||
168 | ||
b1f33d62 RR |
169 | Low-level commands (plumbing) |
170 | ----------------------------- | |
171 | ||
172 | Although git includes its | |
173 | own porcelain layer, its low-level commands are sufficient to support | |
174 | development of alternative porcelains. Developers of such porcelains | |
175 | might start by reading about gitlink:git-update-index[1] and | |
176 | gitlink:git-read-tree[1]. | |
177 | ||
89bf2077 JH |
178 | The interface (input, output, set of options and the semantics) |
179 | to these low-level commands are meant to be a lot more stable | |
180 | than Porcelain level commands, because these commands are | |
181 | primarily for scripted use. The interface to Porcelain commands | |
182 | on the other hand are subject to change in order to improve the | |
183 | end user experience. | |
184 | ||
185 | The following description divides | |
186 | the low-level commands into commands that manipulate objects (in | |
b1f33d62 RR |
187 | the repository, index, and working tree), commands that interrogate and |
188 | compare objects, and commands that move objects and references between | |
189 | repositories. | |
190 | ||
89bf2077 | 191 | |
b1f33d62 RR |
192 | Manipulation commands |
193 | ~~~~~~~~~~~~~~~~~~~~~ | |
b1f33d62 | 194 | |
377e8139 | 195 | include::cmds-plumbingmanipulators.txt[] |
b1f33d62 RR |
196 | |
197 | ||
198 | Interrogation commands | |
199 | ~~~~~~~~~~~~~~~~~~~~~~ | |
200 | ||
377e8139 | 201 | include::cmds-plumbinginterrogators.txt[] |
b1f33d62 RR |
202 | |
203 | In general, the interrogate commands do not touch the files in | |
204 | the working tree. | |
205 | ||
206 | ||
207 | Synching repositories | |
208 | ~~~~~~~~~~~~~~~~~~~~~ | |
209 | ||
377e8139 | 210 | include::cmds-synchingrepositories.txt[] |
b1f33d62 | 211 | |
89bf2077 JH |
212 | The following are helper programs used by the above; end users |
213 | typically do not use them directly. | |
214 | ||
215 | include::cmds-synchelpers.txt[] | |
216 | ||
217 | ||
218 | Internal helper commands | |
219 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
220 | ||
221 | These are internal helper commands used by other commands; end | |
222 | users typically do not use them directly. | |
223 | ||
224 | include::cmds-purehelpers.txt[] | |
225 | ||
b1f33d62 | 226 | |
5773c9f2 JH |
227 | Configuration Mechanism |
228 | ----------------------- | |
229 | ||
2fa090b6 | 230 | Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file |
5773c9f2 | 231 | is used to hold per-repository configuration options. It is a |
addf88e4 | 232 | simple text file modeled after `.ini` format familiar to some |
5773c9f2 JH |
233 | people. Here is an example: |
234 | ||
235 | ------------ | |
236 | # | |
2fa090b6 | 237 | # A '#' or ';' character indicates a comment. |
5773c9f2 JH |
238 | # |
239 | ||
240 | ; core variables | |
241 | [core] | |
242 | ; Don't trust file modes | |
243 | filemode = false | |
244 | ||
245 | ; user identity | |
246 | [user] | |
247 | name = "Junio C Hamano" | |
248 | email = "junkio@twinsun.com" | |
249 | ||
250 | ------------ | |
251 | ||
252 | Various commands read from the configuration file and adjust | |
253 | their operation accordingly. | |
254 | ||
255 | ||
6c84e2e0 | 256 | Identifier Terminology |
2cf565c5 DG |
257 | ---------------------- |
258 | <object>:: | |
2fa090b6 | 259 | Indicates the object name for any type of object. |
2cf565c5 DG |
260 | |
261 | <blob>:: | |
2fa090b6 | 262 | Indicates a blob object name. |
2cf565c5 DG |
263 | |
264 | <tree>:: | |
2fa090b6 | 265 | Indicates a tree object name. |
2cf565c5 DG |
266 | |
267 | <commit>:: | |
2fa090b6 | 268 | Indicates a commit object name. |
2cf565c5 DG |
269 | |
270 | <tree-ish>:: | |
2fa090b6 | 271 | Indicates a tree, commit or tag object name. A |
6c84e2e0 DG |
272 | command that takes a <tree-ish> argument ultimately wants to |
273 | operate on a <tree> object but automatically dereferences | |
274 | <commit> and <tag> objects that point at a <tree>. | |
2cf565c5 | 275 | |
043d7605 TT |
276 | <commit-ish>:: |
277 | Indicates a commit or tag object name. A | |
278 | command that takes a <commit-ish> argument ultimately wants to | |
279 | operate on a <commit> object but automatically dereferences | |
280 | <tag> objects that point at a <commit>. | |
281 | ||
2cf565c5 DG |
282 | <type>:: |
283 | Indicates that an object type is required. | |
2fa090b6 | 284 | Currently one of: `blob`, `tree`, `commit`, or `tag`. |
2cf565c5 DG |
285 | |
286 | <file>:: | |
2fa090b6 JH |
287 | Indicates a filename - almost always relative to the |
288 | root of the tree structure `GIT_INDEX_FILE` describes. | |
2cf565c5 | 289 | |
c1bdacf9 DG |
290 | Symbolic Identifiers |
291 | -------------------- | |
90933efb | 292 | Any git command accepting any <object> can also use the following |
6c84e2e0 | 293 | symbolic notation: |
c1bdacf9 DG |
294 | |
295 | HEAD:: | |
2fa090b6 JH |
296 | indicates the head of the current branch (i.e. the |
297 | contents of `$GIT_DIR/HEAD`). | |
298 | ||
c1bdacf9 | 299 | <tag>:: |
2fa090b6 JH |
300 | a valid tag 'name' |
301 | (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`). | |
302 | ||
c1bdacf9 | 303 | <head>:: |
2fa090b6 JH |
304 | a valid head 'name' |
305 | (i.e. the contents of `$GIT_DIR/refs/heads/<head>`). | |
306 | ||
d47107d8 JH |
307 | For a more complete list of ways to spell object names, see |
308 | "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1]. | |
309 | ||
c1bdacf9 DG |
310 | |
311 | File/Directory Structure | |
312 | ------------------------ | |
c1bdacf9 | 313 | |
a1d4aa74 | 314 | Please see link:repository-layout.html[repository layout] document. |
c1bdacf9 | 315 | |
6250ad1e JL |
316 | Read link:hooks.html[hooks] for more details about each hook. |
317 | ||
c1bdacf9 | 318 | Higher level SCMs may provide and manage additional information in the |
2fa090b6 | 319 | `$GIT_DIR`. |
c1bdacf9 | 320 | |
a1d4aa74 | 321 | |
2cf565c5 DG |
322 | Terminology |
323 | ----------- | |
1bff6490 | 324 | Please see link:glossary.html[glossary] document. |
2cf565c5 DG |
325 | |
326 | ||
327 | Environment Variables | |
328 | --------------------- | |
329 | Various git commands use the following environment variables: | |
330 | ||
c1bdacf9 DG |
331 | The git Repository |
332 | ~~~~~~~~~~~~~~~~~~ | |
333 | These environment variables apply to 'all' core git commands. Nb: it | |
334 | is worth noting that they may be used/overridden by SCMS sitting above | |
2fa090b6 | 335 | git so take care if using Cogito etc. |
c1bdacf9 DG |
336 | |
337 | 'GIT_INDEX_FILE':: | |
338 | This environment allows the specification of an alternate | |
5f3aa197 LS |
339 | index file. If not specified, the default of `$GIT_DIR/index` |
340 | is used. | |
c1bdacf9 DG |
341 | |
342 | 'GIT_OBJECT_DIRECTORY':: | |
343 | If the object storage directory is specified via this | |
344 | environment variable then the sha1 directories are created | |
345 | underneath - otherwise the default `$GIT_DIR/objects` | |
346 | directory is used. | |
347 | ||
348 | 'GIT_ALTERNATE_OBJECT_DIRECTORIES':: | |
349 | Due to the immutable nature of git objects, old objects can be | |
350 | archived into shared, read-only directories. This variable | |
90933efb | 351 | specifies a ":" separated list of git object directories which |
c1bdacf9 DG |
352 | can be used to search for git objects. New objects will not be |
353 | written to these directories. | |
354 | ||
355 | 'GIT_DIR':: | |
2fa090b6 JH |
356 | If the 'GIT_DIR' environment variable is set then it |
357 | specifies a path to use instead of the default `.git` | |
358 | for the base of the repository. | |
c1bdacf9 | 359 | |
892c41b9 ML |
360 | 'GIT_WORK_TREE':: |
361 | Set the path to the working tree. The value will not be | |
362 | used in combination with repositories found automatically in | |
363 | a .git directory (i.e. $GIT_DIR is not set). | |
364 | This can also be controlled by the '--work-tree' command line | |
365 | option and the core.worktree configuration variable. | |
366 | ||
c1bdacf9 DG |
367 | git Commits |
368 | ~~~~~~~~~~~ | |
369 | 'GIT_AUTHOR_NAME':: | |
370 | 'GIT_AUTHOR_EMAIL':: | |
371 | 'GIT_AUTHOR_DATE':: | |
372 | 'GIT_COMMITTER_NAME':: | |
373 | 'GIT_COMMITTER_EMAIL':: | |
4e58bf97 | 374 | 'GIT_COMMITTER_DATE':: |
28a94f88 | 375 | 'EMAIL':: |
a7154e91 | 376 | see gitlink:git-commit-tree[1] |
c1bdacf9 DG |
377 | |
378 | git Diffs | |
379 | ~~~~~~~~~ | |
d81ed1b5 | 380 | 'GIT_DIFF_OPTS':: |
fde97d8a SE |
381 | Only valid setting is "--unified=??" or "-u??" to set the |
382 | number of context lines shown when a unified diff is created. | |
383 | This takes precedence over any "-U" or "--unified" option | |
384 | value passed on the git diff command line. | |
385 | ||
d81ed1b5 | 386 | 'GIT_EXTERNAL_DIFF':: |
fde97d8a SE |
387 | When the environment variable 'GIT_EXTERNAL_DIFF' is set, the |
388 | program named by it is called, instead of the diff invocation | |
389 | described above. For a path that is added, removed, or modified, | |
390 | 'GIT_EXTERNAL_DIFF' is called with 7 parameters: | |
391 | ||
392 | path old-file old-hex old-mode new-file new-hex new-mode | |
393 | + | |
394 | where: | |
395 | ||
396 | <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the | |
397 | contents of <old|new>, | |
398 | <old|new>-hex:: are the 40-hexdigit SHA1 hashes, | |
399 | <old|new>-mode:: are the octal representation of the file modes. | |
400 | ||
401 | + | |
402 | The file parameters can point at the user's working file | |
403 | (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file` | |
404 | when a new file is added), or a temporary file (e.g. `old-file` in the | |
405 | index). 'GIT_EXTERNAL_DIFF' should not worry about unlinking the | |
406 | temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits. | |
407 | + | |
408 | For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1 | |
409 | parameter, <path>. | |
2cf565c5 | 410 | |
575ba9d6 ML |
411 | other |
412 | ~~~~~ | |
c27d205a ML |
413 | 'GIT_PAGER':: |
414 | This environment variable overrides `$PAGER`. | |
415 | ||
06f59e9f TT |
416 | 'GIT_FLUSH':: |
417 | If this environment variable is set to "1", then commands such | |
418 | as git-blame (in incremental mode), git-rev-list, git-log, | |
419 | git-whatchanged, etc., will force a flush of the output stream | |
420 | after each commit-oriented record have been flushed. If this | |
421 | variable is set to "0", the output of these commands will be done | |
422 | using completely buffered I/O. If this environment variable is | |
423 | not set, git will choose buffered or record-oriented flushing | |
424 | based on whether stdout appears to be redirected to a file or not. | |
425 | ||
575ba9d6 | 426 | 'GIT_TRACE':: |
2886bdb1 CC |
427 | If this variable is set to "1", "2" or "true" (comparison |
428 | is case insensitive), git will print `trace:` messages on | |
575ba9d6 ML |
429 | stderr telling about alias expansion, built-in command |
430 | execution and external command execution. | |
2886bdb1 CC |
431 | If this variable is set to an integer value greater than 1 |
432 | and lower than 10 (strictly) then git will interpret this | |
433 | value as an open file descriptor and will try to write the | |
434 | trace messages into this file descriptor. | |
435 | Alternatively, if this variable is set to an absolute path | |
436 | (starting with a '/' character), git will interpret this | |
437 | as a file path and will try to write the trace messages | |
438 | into it. | |
575ba9d6 | 439 | |
8db9307c JH |
440 | Discussion[[Discussion]] |
441 | ------------------------ | |
556b6600 | 442 | include::core-intro.txt[] |
6c84e2e0 | 443 | |
cb22bc44 AE |
444 | Authors |
445 | ------- | |
9755afbd JH |
446 | * git's founding father is Linus Torvalds <torvalds@osdl.org>. |
447 | * The current git nurse is Junio C Hamano <junkio@cox.net>. | |
448 | * The git potty was written by Andres Ericsson <ae@op5.se>. | |
449 | * General upbringing is handled by the git-list <git@vger.kernel.org>. | |
2cf565c5 DG |
450 | |
451 | Documentation | |
452 | -------------- | |
9755afbd JH |
453 | The documentation for git suite was started by David Greaves |
454 | <david@dgreaves.com>, and later enhanced greatly by the | |
455 | contributors on the git-list <git@vger.kernel.org>. | |
2cf565c5 DG |
456 | |
457 | GIT | |
458 | --- | |
a7154e91 | 459 | Part of the gitlink:git[7] suite |