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