Documentation for git-shell
[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 'git-<command>' <args>
12
13 DESCRIPTION
14 -----------
15
16 This is reference information for the core git commands.
17
18 Before reading this cover to cover, you may want to take a look
19 at the link:tutorial.html[tutorial] document.
20
21 The <<Discussion>> section below contains much useful definition and
22 clarification info - read that first.  And of the commands, I suggest
23 reading gitlink:git-update-index[1] and
24 gitlink:git-read-tree[1] first - I wish I had!
25
26 If you are migrating from CVS, link:cvs-migration.html[cvs migration]
27 document may be helpful after you finish the tutorial.
28
29 After you get the general feel from the tutorial and this
30 overview page, you may want to take a look at the
31 link:howto-index.html[howto] documents.
32
33
34 David Greaves <david@dgreaves.com>
35 08/05/05
36
37 Updated by Junio C Hamano <junkio@cox.net> on 2005-05-05 to
38 reflect recent changes.
39
40 Commands Overview
41 -----------------
42 The git commands can helpfully be split into those that manipulate
43 the repository, the cache and the working fileset, those that
44 interrogate and compare them, and those that moves objects and
45 references between repositories.
46
47 In addition, git itself comes with a spartan set of porcelain
48 commands.  They are usable but are not meant to compete with real
49 Porcelains.
50
51 There are also some ancillary programs that can be viewed as useful
52 aids for using the core commands but which are unlikely to be used by
53 SCMs layered over git.
54
55 Manipulation commands
56 ~~~~~~~~~~~~~~~~~~~~~
57 gitlink:git-apply[1]::
58         Reads a "diff -up1" or git generated patch file and
59         applies it to the working tree.
60
61 gitlink:git-checkout-index[1]::
62         Copy files from the cache to the working directory
63         Previously this command was known as git-checkout-cache.
64
65 gitlink:git-commit-tree[1]::
66         Creates a new commit object
67
68 gitlink:git-hash-object[1]::
69         Computes the object ID from a file.
70
71 gitlink:git-index-pack.html[1]::
72         Build pack index file for an existing packed archive.
73
74 gitlink:git-init-db[1]::
75         Creates an empty git object database
76
77 gitlink:git-merge-index[1]::
78         Runs a merge for files needing merging
79         Previously this command was known as git-merge-cache.
80
81 gitlink:git-mktag[1]::
82         Creates a tag object
83
84 gitlink:git-pack-objects[1]::
85         Creates a packed archive of objects.
86
87 gitlink:git-prune-packed[1]::
88         Remove extra objects that are already in pack files.
89
90 gitlink:git-read-tree[1]::
91         Reads tree information into the directory cache
92
93 gitlink:git-unpack-objects[1]::
94         Unpacks objects out of a packed archive.
95
96 gitlink:git-update-index[1]::
97         Modifies the index or directory cache
98         Previously this command was known as git-update-cache.
99
100 gitlink:git-write-tree[1]::
101         Creates a tree from the current cache
102
103
104 Interrogation commands
105 ~~~~~~~~~~~~~~~~~~~~~~
106
107 gitlink:git-cat-file[1]::
108         Provide content or type information for repository objects
109
110 gitlink:git-diff-index[1]::
111         Compares content and mode of blobs between the cache and repository
112         Previously this command was known as git-diff-cache.
113
114 gitlink:git-diff-files[1]::
115         Compares files in the working tree and the cache
116
117 gitlink:git-diff-stages[1]::
118         Compares two "merge stages" in the index file.
119
120 gitlink:git-diff-tree[1]::
121         Compares the content and mode of blobs found via two tree objects
122
123 gitlink:git-fsck-objects[1]::
124         Verifies the connectivity and validity of the objects in the database
125         Previously this command was known as git-fsck-cache.
126
127 gitlink:git-ls-files[1]::
128         Information about files in the cache/working directory
129
130 gitlink:git-ls-tree[1]::
131         Displays a tree object in human readable form
132
133 gitlink:git-merge-base[1]::
134         Finds as good a common ancestor as possible for a merge
135
136 gitlink:git-rev-list[1]::
137         Lists commit objects in reverse chronological order
138
139 gitlink:git-show-index[1]::
140         Displays contents of a pack idx file.
141
142 gitlink:git-tar-tree[1]::
143         Creates a tar archive of the files in the named tree
144
145 gitlink:git-unpack-file[1]::
146         Creates a temporary file with a blob's contents
147
148 gitlink:git-var[1]::
149         Displays a git logical variable
150
151 gitlink:git-verify-pack[1]::
152         Validates packed git archive files
153
154 The interrogate commands may create files - and you can force them to
155 touch the working file set - but in general they don't
156
157
158 Synching repositories
159 ~~~~~~~~~~~~~~~~~~~~~
160
161 gitlink:git-clone-pack[1]::
162         Clones a repository into the current repository (engine
163         for ssh and local transport)
164
165 gitlink:git-fetch-pack[1]::
166         Updates from a remote repository.
167
168 gitlink:git-http-fetch[1]::
169         Downloads a remote git repository via HTTP
170         Previously this command was known as git-http-pull.
171
172 gitlink:git-local-fetch[1]::
173         Duplicates another git repository on a local system
174         Previously this command was known as git-local-pull.
175
176 gitlink:git-peek-remote[1]::
177         Lists references on a remote repository using upload-pack protocol.
178
179 gitlink:git-receive-pack[1]::
180         Invoked by 'git-send-pack' to receive what is pushed to it.
181
182 gitlink:git-send-pack[1]::
183         Pushes to a remote repository, intelligently.
184
185 gitlink:git-shell[1]::
186         Restricted shell for GIT-only SSH access.
187
188 gitlink:git-ssh-fetch[1]::
189         Pulls from a remote repository over ssh connection
190         Previously this command was known as git-ssh-pull.
191
192 gitlink:git-ssh-upload[1]::
193         Helper "server-side" program used by git-ssh-fetch
194         Previously this command was known as git-ssh-push.
195
196 gitlink:git-update-server-info[1]::
197         Updates auxiliary information on a dumb server to help
198         clients discover references and packs on it.
199
200 gitlink:git-upload-pack[1]::
201         Invoked by 'git-clone-pack' and 'git-fetch-pack' to push
202         what are asked for.
203
204
205 Porcelain-ish Commands
206 ----------------------
207
208 gitlink:git-add[1]::
209         Add paths to the index file.
210         Previously this command was known as git-add-script.
211
212 gitlink:git-applymbox[1]::
213         Apply patches from a mailbox.
214
215 gitlink:git-bisect[1]::
216         Find the change that introduced a bug.
217         Previously this command was known as git-bisect-script.
218
219 gitlink:git-branch[1]::
220         Create and Show branches.
221         Previously this command was known as git-branch-script.
222
223 gitlink:git-checkout[1]::
224         Checkout and switch to a branch.
225         Previously this command was known as git-checkout-script.
226
227 gitlink:git-cherry-pick[1]::
228         Cherry-pick the effect of an existing commit.
229         Previously this command was known as git-cherry-pick-script.
230
231 gitlink:git-clone[1]::
232         Clones a repository into a new directory.
233         Previously this command was known as git-clone-script.
234
235 gitlink:git-commit[1]::
236         Record changes to the repository.
237         Previously this command was known as git-commit-script.
238
239 gitlink:git-diff[1]::
240         Show changes between commits, commit and working tree, etc.
241         Previously this command was known as git-diff-script.
242
243 gitlink:git-fetch[1]::
244         Download from a remote repository via various protocols.
245         Previously this command was known as git-fetch-script.
246
247 gitlink:git-format-patch[1]::
248         Prepare patches for e-mail submission.
249         Previously this command was known as git-format-patch-script.
250
251 gitlink:git-grep[1]::
252         Print lines matching a pattern
253
254 gitlink:git-log[1]::
255         Shows commit logs.
256         Previously this command was known as git-log-script.
257
258 gitlink:git-ls-remote[1]::
259         Shows references in a remote or local repository.
260         Previously this command was known as git-ls-remote-script.
261
262 gitlink:git-merge[1]::
263         Grand unified merge driver.
264
265 gitlink:git-octopus[1]::
266         Merge more than two commits.
267         Previously this command was known as git-octopus-script.
268
269 gitlink:git-pull[1]::
270         Fetch from and merge with a remote repository.
271         Previously this command was known as git-pull-script.
272
273 gitlink:git-push[1]::
274         Update remote refs along with associated objects.
275         Previously this command was known as git-push-script.
276
277 gitlink:git-rebase[1]::
278         Rebase local commits to new upstream head.
279         Previously this command was known as git-rebase-script.
280
281 gitlink:git-rename[1]::
282         Rename files and directories.
283         Previously this command was known as git-rename-script.
284
285 gitlink:git-repack[1]::
286         Pack unpacked objects in a repository.
287         Previously this command was known as git-repack-script.
288
289 gitlink:git-reset[1]::
290         Reset current HEAD to the specified state.
291         Previously this command was known as git-reset-script.
292
293 gitlink:git-resolve[1]::
294         Merge two commits.
295         Previously this command was known as git-resolve-script.
296
297 gitlink:git-revert[1]::
298         Revert an existing commit.
299         Previously this command was known as git-revert-script.
300
301 gitlink:git-shortlog[1]::
302         Summarizes 'git log' output.
303
304 gitlink:git-show-branch[1]::
305         Show branches and their commits.
306
307 gitlink:git-status[1]::
308         Shows the working tree status.
309         Previously this command was known as git-status-script.
310
311 gitlink:git-verify-tag[1]::
312         Check the GPG signature of tag.
313         Previously this command was known as git-verify-tag-script.
314
315 gitlink:git-whatchanged[1]::
316         Shows commit logs and differences they introduce.
317
318
319 Ancillary Commands
320 ------------------
321 Manipulators:
322
323 gitlink:git-applypatch[1]::
324         Apply one patch extracted from an e-mail.
325
326 gitlink:git-archimport[1]::
327         Import an arch repository into git.
328         Previously this command was known as git-archimport-script.
329
330 gitlink:git-convert-objects[1]::
331         Converts old-style git repository
332         Previously this command was known as git-convert-cache.
333
334 gitlink:git-cvsimport[1]::
335         Salvage your data out of another SCM people love to hate.
336         Previously this command was known as git-cvsimport-script.
337
338 gitlink:git-merge-one-file[1]::
339         The standard helper program to use with "git-merge-index"
340         Previously this command was known as git-merge-one-file-script.
341
342 gitlink:git-prune[1]::
343         Prunes all unreachable objects from the object database
344         Previously this command was known as git-prune-script.
345
346 gitlink:git-relink[1]::
347         Hardlink common objects in local repositories.
348         Previously this command was known as git-relink-script.
349
350 gitlink:git-sh-setup[1]::
351         Common git shell script setup code.
352         Previously this command was known as git-sh-setup-script.
353
354 gitlink:git-tag[1]::
355         An example script to create a tag object signed with GPG
356         Previously this command was known as git-tag-script.
357
358
359 Interrogators:
360
361 gitlink:git-cherry[1]::
362         Find commits not merged upstream.
363
364 gitlink:git-count-objects[1]::
365         Count unpacked number of objects and their disk consumption.
366         Previously this command was known as git-count-objects-script.
367
368 gitlink:git-daemon[1]::
369         A really simple server for git repositories.
370
371 gitlink:git-get-tar-commit-id[1]::
372         Extract commit ID from an archive created using git-tar-tree.
373
374 gitlink:git-mailinfo[1]::
375         Extracts patch from a single e-mail message.
376
377 gitlink:git-mailsplit[1]::
378         git-mailsplit.
379
380 gitlink:git-patch-id[1]::
381         Compute unique ID for a patch.
382
383 gitlink:git-parse-remote[1]::
384         Routines to help parsing $GIT_DIR/remotes/
385         Previously this command was known as git-parse-remote-script.
386
387 gitlink:git-request-pull[1]::
388         git-request-pull.
389         Previously this command was known as git-request-pull-script.
390
391 gitlink:git-rev-parse[1]::
392         Pick out and massage parameters.
393
394 gitlink:git-send-email[1]::
395         Send patch e-mails out of "format-patch --mbox" output.
396         Previously this command was known as git-send-email-script.
397
398 gitlink:git-stripspace[1]::
399         Filter out empty lines.
400
401
402 Commands not yet documented
403 ---------------------------
404
405 gitlink:gitk[1]::
406         gitk.
407
408
409 Identifier Terminology
410 ----------------------
411 <object>::
412         Indicates the sha1 identifier for any type of object
413
414 <blob>::
415         Indicates a blob object sha1 identifier
416
417 <tree>::
418         Indicates a tree object sha1 identifier
419
420 <commit>::
421         Indicates a commit object sha1 identifier
422
423 <tree-ish>::
424         Indicates a tree, commit or tag object sha1 identifier.  A
425         command that takes a <tree-ish> argument ultimately wants to
426         operate on a <tree> object but automatically dereferences
427         <commit> and <tag> objects that point at a <tree>.
428
429 <type>::
430         Indicates that an object type is required.
431         Currently one of: blob/tree/commit/tag
432
433 <file>::
434         Indicates a filename - always relative to the root of
435         the tree structure GIT_INDEX_FILE describes.
436
437 Symbolic Identifiers
438 --------------------
439 Any git command accepting any <object> can also use the following
440 symbolic notation:
441
442 HEAD::
443         indicates the head of the repository (ie the contents of
444         `$GIT_DIR/HEAD`)
445 <tag>::
446         a valid tag 'name'+
447         (ie the contents of `$GIT_DIR/refs/tags/<tag>`)
448 <head>::
449         a valid head 'name'+
450         (ie the contents of `$GIT_DIR/refs/heads/<head>`)
451 <snap>::
452         a valid snapshot 'name'+
453         (ie the contents of `$GIT_DIR/refs/snap/<snap>`)
454
455
456 File/Directory Structure
457 ------------------------
458
459 Please see link:repository-layout.html[repository layout] document.
460
461 Higher level SCMs may provide and manage additional information in the
462 GIT_DIR.
463
464
465 Terminology
466 -----------
467 Please see link:glossary.html[glossary] document.
468
469
470 Environment Variables
471 ---------------------
472 Various git commands use the following environment variables:
473
474 The git Repository
475 ~~~~~~~~~~~~~~~~~~
476 These environment variables apply to 'all' core git commands. Nb: it
477 is worth noting that they may be used/overridden by SCMS sitting above
478 git so take care if using Cogito etc
479
480 'GIT_INDEX_FILE'::
481         This environment allows the specification of an alternate
482         cache/index file. If not specified, the default of
483         `$GIT_DIR/index` is used.
484
485 'GIT_OBJECT_DIRECTORY'::
486         If the object storage directory is specified via this
487         environment variable then the sha1 directories are created
488         underneath - otherwise the default `$GIT_DIR/objects`
489         directory is used.
490
491 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
492         Due to the immutable nature of git objects, old objects can be
493         archived into shared, read-only directories. This variable
494         specifies a ":" separated list of git object directories which
495         can be used to search for git objects. New objects will not be
496         written to these directories.
497
498 'GIT_DIR'::
499         If the 'GIT_DIR' environment variable is set then it specifies
500         a path to use instead of `./.git` for the base of the
501         repository.
502
503 git Commits
504 ~~~~~~~~~~~
505 'GIT_AUTHOR_NAME'::
506 'GIT_AUTHOR_EMAIL'::
507 'GIT_AUTHOR_DATE'::
508 'GIT_COMMITTER_NAME'::
509 'GIT_COMMITTER_EMAIL'::
510         see gitlink:git-commit-tree[1]
511
512 git Diffs
513 ~~~~~~~~~
514 'GIT_DIFF_OPTS'::
515 'GIT_EXTERNAL_DIFF'::
516         see the "generating patches" section in :
517         gitlink:git-diff-index[1];
518         gitlink:git-diff-files[1];
519         gitlink:git-diff-tree[1]
520
521 Discussion[[Discussion]]
522 ------------------------
523 include::../README[]
524
525 Author
526 ------
527 Written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>.
528
529 Documentation
530 --------------
531 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
532
533 GIT
534 ---
535 Part of the gitlink:git[7] suite
536