6 git - the stupid content tracker
11 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ARGS]
15 'git' is both a program and a directory content tracker system.
16 The program 'git' is just a wrapper to reach the core git programs
17 (or a potty if you like, as it's not exactly porcelain but still
18 brings your stuff to the plumbing).
23 Prints the git suite version that the 'git' program came from.
26 Prints the synopsis and a list of the most commonly used
27 commands. If a git command is named this option will bring up
28 the man-page for that command. If the option '--all' or '-a' is
29 given then all available commands are printed.
32 Path to wherever your core git programs are installed.
33 This can also be controlled by setting the GIT_EXEC_PATH
34 environment variable. If no path is given 'git' will print
35 the current setting and then exit.
38 NOT LEARNING CORE GIT COMMANDS
39 ------------------------------
41 This manual is intended to give complete background information
42 and internal workings of git, which may be too much for most
43 people. The <<Discussion>> section below contains much useful
44 definition and clarification - read that first.
46 If you are interested in using git to manage (version control)
47 projects, use link:tutorial.html[The Tutorial] to get you started,
48 and then link:everyday.html[Everyday GIT] as a guide to the
49 minimum set of commands you need to know for day-to-day work.
50 Most likely, that will get you started, and you can go a long
51 way without knowing the low level details too much.
53 The link:core-tutorial.html[Core tutorial] document covers how things
56 If you are migrating from CVS, link:cvs-migration.html[cvs
57 migration] document may be helpful after you finish the
60 After you get the general feel from the tutorial and this
61 overview page, you may want to take a look at the
62 link:howto-index.html[howto] documents.
68 If you are writing your own Porcelain, you need to be familiar
69 with most of the low level commands --- I suggest starting from
70 gitlink:git-update-index[1] and gitlink:git-read-tree[1].
75 The git commands can helpfully be split into those that manipulate
76 the repository, the index and the files in the working tree, those that
77 interrogate and compare them, and those that moves objects and
78 references between repositories.
80 In addition, git itself comes with a spartan set of porcelain
81 commands. They are usable but are not meant to compete with real
84 There are also some ancillary programs that can be viewed as useful
85 aids for using the core commands but which are unlikely to be used by
86 SCMs layered over git.
90 gitlink:git-apply[1]::
91 Reads a "diff -up1" or git generated patch file and
92 applies it to the working tree.
94 gitlink:git-checkout-index[1]::
95 Copy files from the index to the working tree.
97 gitlink:git-commit-tree[1]::
98 Creates a new commit object.
100 gitlink:git-hash-object[1]::
101 Computes the object ID from a file.
103 gitlink:git-index-pack[1]::
104 Build pack idx file for an existing packed archive.
106 gitlink:git-init-db[1]::
107 Creates an empty git object database, or reinitialize an
110 gitlink:git-merge-index[1]::
111 Runs a merge for files needing merging.
113 gitlink:git-mktag[1]::
114 Creates a tag object.
116 gitlink:git-pack-objects[1]::
117 Creates a packed archive of objects.
119 gitlink:git-prune-packed[1]::
120 Remove extra objects that are already in pack files.
122 gitlink:git-read-tree[1]::
123 Reads tree information into the index.
125 gitlink:git-repo-config[1]::
126 Get and set options in .git/config.
128 gitlink:git-unpack-objects[1]::
129 Unpacks objects out of a packed archive.
131 gitlink:git-update-index[1]::
132 Registers files in the working tree to the index.
134 gitlink:git-write-tree[1]::
135 Creates a tree from the index.
138 Interrogation commands
139 ~~~~~~~~~~~~~~~~~~~~~~
141 gitlink:git-cat-file[1]::
142 Provide content or type/size information for repository objects.
144 gitlink:git-describe[1]::
145 Show the most recent tag that is reachable from a commit.
147 gitlink:git-diff-index[1]::
148 Compares content and mode of blobs between the index and repository.
150 gitlink:git-diff-files[1]::
151 Compares files in the working tree and the index.
153 gitlink:git-diff-stages[1]::
154 Compares two "merge stages" in the index.
156 gitlink:git-diff-tree[1]::
157 Compares the content and mode of blobs found via two tree objects.
159 gitlink:git-fsck-objects[1]::
160 Verifies the connectivity and validity of the objects in the database.
162 gitlink:git-ls-files[1]::
163 Information about files in the index and the working tree.
165 gitlink:git-ls-tree[1]::
166 Displays a tree object in human readable form.
168 gitlink:git-merge-base[1]::
169 Finds as good common ancestors as possible for a merge.
171 gitlink:git-name-rev[1]::
172 Find symbolic names for given revs.
174 gitlink:git-pack-redundant[1]::
175 Find redundant pack files.
177 gitlink:git-rev-list[1]::
178 Lists commit objects in reverse chronological order.
180 gitlink:git-show-index[1]::
181 Displays contents of a pack idx file.
183 gitlink:git-tar-tree[1]::
184 Creates a tar archive of the files in the named tree object.
186 gitlink:git-unpack-file[1]::
187 Creates a temporary file with a blob's contents.
190 Displays a git logical variable.
192 gitlink:git-verify-pack[1]::
193 Validates packed git archive files.
195 In general, the interrogate commands do not touch the files in
199 Synching repositories
200 ~~~~~~~~~~~~~~~~~~~~~
202 gitlink:git-clone-pack[1]::
203 Clones a repository into the current repository (engine
204 for ssh and local transport).
206 gitlink:git-fetch-pack[1]::
207 Updates from a remote repository (engine for ssh and
210 gitlink:git-http-fetch[1]::
211 Downloads a remote git repository via HTTP by walking
214 gitlink:git-local-fetch[1]::
215 Duplicates another git repository on a local system by
216 walking commit chain.
218 gitlink:git-peek-remote[1]::
219 Lists references on a remote repository using
220 upload-pack protocol (engine for ssh and local
223 gitlink:git-receive-pack[1]::
224 Invoked by 'git-send-pack' to receive what is pushed to it.
226 gitlink:git-send-pack[1]::
227 Pushes to a remote repository, intelligently.
229 gitlink:git-http-push[1]::
230 Push missing objects using HTTP/DAV.
232 gitlink:git-shell[1]::
233 Restricted shell for GIT-only SSH access.
235 gitlink:git-ssh-fetch[1]::
236 Pulls from a remote repository over ssh connection by
237 walking commit chain.
239 gitlink:git-ssh-upload[1]::
240 Helper "server-side" program used by git-ssh-fetch.
242 gitlink:git-update-server-info[1]::
243 Updates auxiliary information on a dumb server to help
244 clients discover references and packs on it.
246 gitlink:git-upload-pack[1]::
247 Invoked by 'git-clone-pack' and 'git-fetch-pack' to push
251 Porcelain-ish Commands
252 ----------------------
255 Add paths to the index.
258 Apply patches from a mailbox, but cooler.
260 gitlink:git-applymbox[1]::
261 Apply patches from a mailbox, original version by Linus.
263 gitlink:git-bisect[1]::
264 Find the change that introduced a bug by binary search.
266 gitlink:git-branch[1]::
267 Create and Show branches.
269 gitlink:git-checkout[1]::
270 Checkout and switch to a branch.
272 gitlink:git-cherry-pick[1]::
273 Cherry-pick the effect of an existing commit.
275 gitlink:git-clone[1]::
276 Clones a repository into a new directory.
278 gitlink:git-commit[1]::
279 Record changes to the repository.
281 gitlink:git-diff[1]::
282 Show changes between commits, commit and working tree, etc.
284 gitlink:git-fetch[1]::
285 Download from a remote repository via various protocols.
287 gitlink:git-format-patch[1]::
288 Prepare patches for e-mail submission.
290 gitlink:git-grep[1]::
291 Print lines matching a pattern.
296 gitlink:git-ls-remote[1]::
297 Shows references in a remote or local repository.
299 gitlink:git-merge[1]::
300 Grand unified merge driver.
303 Move or rename a file, a directory, or a symlink.
305 gitlink:git-pull[1]::
306 Fetch from and merge with a remote repository.
308 gitlink:git-push[1]::
309 Update remote refs along with associated objects.
311 gitlink:git-rebase[1]::
312 Rebase local commits to the updated upstream head.
314 gitlink:git-repack[1]::
315 Pack unpacked objects in a repository.
317 gitlink:git-rerere[1]::
318 Reuse recorded resolution of conflicted merges.
320 gitlink:git-reset[1]::
321 Reset current HEAD to the specified state.
323 gitlink:git-resolve[1]::
326 gitlink:git-revert[1]::
327 Revert an existing commit.
329 gitlink:git-shortlog[1]::
330 Summarizes 'git log' output.
332 gitlink:git-show[1]::
333 Show one commit log and its diff.
335 gitlink:git-show-branch[1]::
336 Show branches and their commits.
338 gitlink:git-status[1]::
339 Shows the working tree status.
341 gitlink:git-verify-tag[1]::
342 Check the GPG signature of tag.
344 gitlink:git-whatchanged[1]::
345 Shows commit logs and differences they introduce.
352 gitlink:git-applypatch[1]::
353 Apply one patch extracted from an e-mail.
355 gitlink:git-archimport[1]::
356 Import an arch repository into git.
358 gitlink:git-convert-objects[1]::
359 Converts old-style git repository.
361 gitlink:git-cvsimport[1]::
362 Salvage your data out of another SCM people love to hate.
364 gitlink:git-cvsexportcommit[1]::
365 Export a single commit to a CVS checkout.
367 gitlink:git-lost-found[1]::
368 Recover lost refs that luckily have not yet been pruned.
370 gitlink:git-merge-one-file[1]::
371 The standard helper program to use with `git-merge-index`.
373 gitlink:git-prune[1]::
374 Prunes all unreachable objects from the object database.
376 gitlink:git-relink[1]::
377 Hardlink common objects in local repositories.
379 gitlink:git-svnimport[1]::
380 Import a SVN repository into git.
382 gitlink:git-sh-setup[1]::
383 Common git shell script setup code.
385 gitlink:git-symbolic-ref[1]::
386 Read and modify symbolic refs.
389 An example script to create a tag object signed with GPG.
391 gitlink:git-update-ref[1]::
392 Update the object name stored in a ref safely.
397 gitlink:git-check-ref-format[1]::
398 Make sure ref name is well formed.
400 gitlink:git-cherry[1]::
401 Find commits not merged upstream.
403 gitlink:git-count-objects[1]::
404 Count unpacked number of objects and their disk consumption.
406 gitlink:git-daemon[1]::
407 A really simple server for git repositories.
409 gitlink:git-get-tar-commit-id[1]::
410 Extract commit ID from an archive created using git-tar-tree.
412 gitlink:git-mailinfo[1]::
413 Extracts patch and authorship information from a single
414 e-mail message, optionally transliterating the commit
417 gitlink:git-mailsplit[1]::
418 A stupid program to split UNIX mbox format mailbox into
419 individual pieces of e-mail.
421 gitlink:git-patch-id[1]::
422 Compute unique ID for a patch.
424 gitlink:git-parse-remote[1]::
425 Routines to help parsing `$GIT_DIR/remotes/` files.
427 gitlink:git-request-pull[1]::
430 gitlink:git-rev-parse[1]::
431 Pick out and massage parameters.
433 gitlink:git-send-email[1]::
434 Send patch e-mails out of "format-patch --mbox" output.
436 gitlink:git-symbolic-ref[1]::
437 Read and modify symbolic refs.
439 gitlink:git-stripspace[1]::
440 Filter out empty lines.
443 Commands not yet documented
444 ---------------------------
447 The gitk repository browser.
450 Configuration Mechanism
451 -----------------------
453 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
454 is used to hold per-repository configuration options. It is a
455 simple text file modelled after `.ini` format familiar to some
456 people. Here is an example:
460 # A '#' or ';' character indicates a comment.
465 ; Don't trust file modes
470 name = "Junio C Hamano"
471 email = "junkio@twinsun.com"
475 Various commands read from the configuration file and adjust
476 their operation accordingly.
479 Identifier Terminology
480 ----------------------
482 Indicates the object name for any type of object.
485 Indicates a blob object name.
488 Indicates a tree object name.
491 Indicates a commit object name.
494 Indicates a tree, commit or tag object name. A
495 command that takes a <tree-ish> argument ultimately wants to
496 operate on a <tree> object but automatically dereferences
497 <commit> and <tag> objects that point at a <tree>.
500 Indicates that an object type is required.
501 Currently one of: `blob`, `tree`, `commit`, or `tag`.
504 Indicates a filename - almost always relative to the
505 root of the tree structure `GIT_INDEX_FILE` describes.
509 Any git command accepting any <object> can also use the following
513 indicates the head of the current branch (i.e. the
514 contents of `$GIT_DIR/HEAD`).
518 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
522 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
525 a valid snapshot 'name'
526 (i.e. the contents of `$GIT_DIR/refs/snap/<snap>`).
529 File/Directory Structure
530 ------------------------
532 Please see link:repository-layout.html[repository layout] document.
534 Higher level SCMs may provide and manage additional information in the
540 Please see link:glossary.html[glossary] document.
543 Environment Variables
544 ---------------------
545 Various git commands use the following environment variables:
549 These environment variables apply to 'all' core git commands. Nb: it
550 is worth noting that they may be used/overridden by SCMS sitting above
551 git so take care if using Cogito etc.
554 This environment allows the specification of an alternate
555 index file. If not specified, the default of `$GIT_DIR/index`
558 'GIT_OBJECT_DIRECTORY'::
559 If the object storage directory is specified via this
560 environment variable then the sha1 directories are created
561 underneath - otherwise the default `$GIT_DIR/objects`
564 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
565 Due to the immutable nature of git objects, old objects can be
566 archived into shared, read-only directories. This variable
567 specifies a ":" separated list of git object directories which
568 can be used to search for git objects. New objects will not be
569 written to these directories.
572 If the 'GIT_DIR' environment variable is set then it
573 specifies a path to use instead of the default `.git`
574 for the base of the repository.
581 'GIT_COMMITTER_NAME'::
582 'GIT_COMMITTER_EMAIL'::
583 see gitlink:git-commit-tree[1]
588 'GIT_EXTERNAL_DIFF'::
589 see the "generating patches" section in :
590 gitlink:git-diff-index[1];
591 gitlink:git-diff-files[1];
592 gitlink:git-diff-tree[1]
594 Discussion[[Discussion]]
595 ------------------------
600 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
601 * The current git nurse is Junio C Hamano <junkio@cox.net>.
602 * The git potty was written by Andres Ericsson <ae@op5.se>.
603 * General upbringing is handled by the git-list <git@vger.kernel.org>.
607 The documentation for git suite was started by David Greaves
608 <david@dgreaves.com>, and later enhanced greatly by the
609 contributors on the git-list <git@vger.kernel.org>.
613 Part of the gitlink:git[7] suite