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