Code

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