6 git - the stupid content tracker
11 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ARGS]
15 Git is a fast, scalable, distributed revision control system with an
16 unusually rich command set that provides both high-level operations
17 and full access to internals.
19 See this link:tutorial.html[tutorial] to get started, then see
20 link:everyday.html[Everyday Git] for a useful minimum set of commands, and
21 "man git-commandname" for documentation of each command. CVS users may
22 also want to read link:cvs-migration.html[CVS migration].
24 The COMMAND is either a name of a Git command (see below) or an alias
25 as defined in the configuration file (see gitlink:git-repo-config[1]).
30 Prints the git suite version that the 'git' program came from.
33 Prints the synopsis and a list of the most commonly used
34 commands. If a git command is named this option will bring up
35 the man-page for that command. If the option '--all' or '-a' is
36 given then all available commands are printed.
39 Path to wherever your core git programs are installed.
40 This can also be controlled by setting the GIT_EXEC_PATH
41 environment variable. If no path is given 'git' will print
42 the current setting and then exit.
48 See the references above to get started using git. The following is
49 probably more detail than necessary for a first-time user.
51 The <<Discussion,Discussion>> section below and the
52 link:core-tutorial.html[Core tutorial] both provide introductions to the
53 underlying git architecture.
55 See also the link:howto-index.html[howto] documents for some useful
61 We divide git into high level ("porcelain") commands and low level
62 ("plumbing") commands.
64 Low-level commands (plumbing)
65 -----------------------------
67 Although git includes its
68 own porcelain layer, its low-level commands are sufficient to support
69 development of alternative porcelains. Developers of such porcelains
70 might start by reading about gitlink:git-update-index[1] and
71 gitlink:git-read-tree[1].
73 We divide the low-level commands into commands that manipulate objects (in
74 the repository, index, and working tree), commands that interrogate and
75 compare objects, and commands that move objects and references between
80 gitlink:git-apply[1]::
81 Reads a "diff -up1" or git generated patch file and
82 applies it to the working tree.
84 gitlink:git-checkout-index[1]::
85 Copy files from the index to the working tree.
87 gitlink:git-commit-tree[1]::
88 Creates a new commit object.
90 gitlink:git-hash-object[1]::
91 Computes the object ID from a file.
93 gitlink:git-index-pack[1]::
94 Build pack idx file for an existing packed archive.
96 gitlink:git-init-db[1]::
97 Creates an empty git object database, or reinitialize an
100 gitlink:git-merge-index[1]::
101 Runs a merge for files needing merging.
103 gitlink:git-mktag[1]::
104 Creates a tag object.
106 gitlink:git-mktree[1]::
107 Build a tree-object from ls-tree formatted text.
109 gitlink:git-pack-objects[1]::
110 Creates a packed archive of objects.
112 gitlink:git-prune-packed[1]::
113 Remove extra objects that are already in pack files.
115 gitlink:git-read-tree[1]::
116 Reads tree information into the index.
118 gitlink:git-repo-config[1]::
119 Get and set options in .git/config.
121 gitlink:git-unpack-objects[1]::
122 Unpacks objects out of a packed archive.
124 gitlink:git-update-index[1]::
125 Registers files in the working tree to the index.
127 gitlink:git-write-tree[1]::
128 Creates a tree from the index.
131 Interrogation commands
132 ~~~~~~~~~~~~~~~~~~~~~~
134 gitlink:git-cat-file[1]::
135 Provide content or type/size information for repository objects.
137 gitlink:git-describe[1]::
138 Show the most recent tag that is reachable from a commit.
140 gitlink:git-diff-index[1]::
141 Compares content and mode of blobs between the index and repository.
143 gitlink:git-diff-files[1]::
144 Compares files in the working tree and the index.
146 gitlink:git-diff-stages[1]::
147 Compares two "merge stages" in the index.
149 gitlink:git-diff-tree[1]::
150 Compares the content and mode of blobs found via two tree objects.
152 gitlink:git-fsck-objects[1]::
153 Verifies the connectivity and validity of the objects in the database.
155 gitlink:git-ls-files[1]::
156 Information about files in the index and the working tree.
158 gitlink:git-ls-tree[1]::
159 Displays a tree object in human readable form.
161 gitlink:git-merge-base[1]::
162 Finds as good common ancestors as possible for a merge.
164 gitlink:git-name-rev[1]::
165 Find symbolic names for given revs.
167 gitlink:git-pack-redundant[1]::
168 Find redundant pack files.
170 gitlink:git-rev-list[1]::
171 Lists commit objects in reverse chronological order.
173 gitlink:git-show-index[1]::
174 Displays contents of a pack idx file.
176 gitlink:git-tar-tree[1]::
177 Creates a tar archive of the files in the named tree object.
179 gitlink:git-unpack-file[1]::
180 Creates a temporary file with a blob's contents.
183 Displays a git logical variable.
185 gitlink:git-verify-pack[1]::
186 Validates packed git archive files.
188 In general, the interrogate commands do not touch the files in
192 Synching repositories
193 ~~~~~~~~~~~~~~~~~~~~~
195 gitlink:git-fetch-pack[1]::
196 Updates from a remote repository (engine for ssh and
199 gitlink:git-http-fetch[1]::
200 Downloads a remote git repository via HTTP by walking
203 gitlink:git-local-fetch[1]::
204 Duplicates another git repository on a local system by
205 walking commit chain.
207 gitlink:git-peek-remote[1]::
208 Lists references on a remote repository using
209 upload-pack protocol (engine for ssh and local
212 gitlink:git-receive-pack[1]::
213 Invoked by 'git-send-pack' to receive what is pushed to it.
215 gitlink:git-send-pack[1]::
216 Pushes to a remote repository, intelligently.
218 gitlink:git-http-push[1]::
219 Push missing objects using HTTP/DAV.
221 gitlink:git-shell[1]::
222 Restricted shell for GIT-only SSH access.
224 gitlink:git-ssh-fetch[1]::
225 Pulls from a remote repository over ssh connection by
226 walking commit chain.
228 gitlink:git-ssh-upload[1]::
229 Helper "server-side" program used by git-ssh-fetch.
231 gitlink:git-update-server-info[1]::
232 Updates auxiliary information on a dumb server to help
233 clients discover references and packs on it.
235 gitlink:git-upload-pack[1]::
236 Invoked by 'git-fetch-pack' to push
239 gitlink:git-upload-tar[1]::
240 Invoked by 'git-tar-tree --remote' to return the tar
241 archive the other end asked for.
244 High-level commands (porcelain)
245 -------------------------------
247 We separate the porcelain commands into the main commands and some
248 ancillary user utilities.
250 Main porcelain commands
251 ~~~~~~~~~~~~~~~~~~~~~~~
254 Add paths to the index.
257 Apply patches from a mailbox, but cooler.
259 gitlink:git-applymbox[1]::
260 Apply patches from a mailbox, original version by Linus.
262 gitlink:git-bisect[1]::
263 Find the change that introduced a bug by binary search.
265 gitlink:git-branch[1]::
266 Create and Show branches.
268 gitlink:git-checkout[1]::
269 Checkout and switch to a branch.
271 gitlink:git-cherry-pick[1]::
272 Cherry-pick the effect of an existing commit.
274 gitlink:git-clean[1]::
275 Remove untracked files from the working tree.
277 gitlink:git-clone[1]::
278 Clones a repository into a new directory.
280 gitlink:git-commit[1]::
281 Record changes to the repository.
283 gitlink:git-diff[1]::
284 Show changes between commits, commit and working tree, etc.
286 gitlink:git-fetch[1]::
287 Download from a remote repository via various protocols.
289 gitlink:git-format-patch[1]::
290 Prepare patches for e-mail submission.
292 gitlink:git-grep[1]::
293 Print lines matching a pattern.
298 gitlink:git-ls-remote[1]::
299 Shows references in a remote or local repository.
301 gitlink:git-merge[1]::
302 Grand unified merge driver.
305 Move or rename a file, a directory, or a symlink.
307 gitlink:git-pull[1]::
308 Fetch from and merge with a remote repository.
310 gitlink:git-push[1]::
311 Update remote refs along with associated objects.
313 gitlink:git-rebase[1]::
314 Rebase local commits to the updated upstream head.
316 gitlink:git-repack[1]::
317 Pack unpacked objects in a repository.
319 gitlink:git-rerere[1]::
320 Reuse recorded resolution of conflicted merges.
322 gitlink:git-reset[1]::
323 Reset current HEAD to the specified state.
325 gitlink:git-resolve[1]::
328 gitlink:git-revert[1]::
329 Revert an existing commit.
332 Remove files from the working tree and from the index.
334 gitlink:git-shortlog[1]::
335 Summarizes 'git log' output.
337 gitlink:git-show[1]::
338 Show one commit log and its diff.
340 gitlink:git-show-branch[1]::
341 Show branches and their commits.
343 gitlink:git-status[1]::
344 Shows the working tree status.
346 gitlink:git-verify-tag[1]::
347 Check the GPG signature of tag.
349 gitlink:git-whatchanged[1]::
350 Shows commit logs and differences they introduce.
357 gitlink:git-applypatch[1]::
358 Apply one patch extracted from an e-mail.
360 gitlink:git-archimport[1]::
361 Import an arch repository into git.
363 gitlink:git-convert-objects[1]::
364 Converts old-style git repository.
366 gitlink:git-cvsimport[1]::
367 Salvage your data out of another SCM people love to hate.
369 gitlink:git-cvsexportcommit[1]::
370 Export a single commit to a CVS checkout.
372 gitlink:git-cvsserver[1]::
373 A CVS server emulator for git.
375 gitlink:git-lost-found[1]::
376 Recover lost refs that luckily have not yet been pruned.
378 gitlink:git-merge-one-file[1]::
379 The standard helper program to use with `git-merge-index`.
381 gitlink:git-prune[1]::
382 Prunes all unreachable objects from the object database.
384 gitlink:git-quiltimport[1]::
385 Applies a quilt patchset onto the current branch.
387 gitlink:git-relink[1]::
388 Hardlink common objects in local repositories.
390 gitlink:git-svnimport[1]::
391 Import a SVN repository into git.
393 gitlink:git-sh-setup[1]::
394 Common git shell script setup code.
396 gitlink:git-symbolic-ref[1]::
397 Read and modify symbolic refs.
400 An example script to create a tag object signed with GPG.
402 gitlink:git-update-ref[1]::
403 Update the object name stored in a ref safely.
408 gitlink:git-annotate[1]::
409 Annotate file lines with commit info.
411 gitlink:git-blame[1]::
412 Blame file lines on commits.
414 gitlink:git-check-ref-format[1]::
415 Make sure ref name is well formed.
417 gitlink:git-cherry[1]::
418 Find commits not merged upstream.
420 gitlink:git-count-objects[1]::
421 Count unpacked number of objects and their disk consumption.
423 gitlink:git-daemon[1]::
424 A really simple server for git repositories.
426 gitlink:git-fmt-merge-msg[1]::
427 Produce a merge commit message.
429 gitlink:git-get-tar-commit-id[1]::
430 Extract commit ID from an archive created using git-tar-tree.
432 gitlink:git-imap-send[1]::
433 Dump a mailbox from stdin into an imap folder.
435 gitlink:git-mailinfo[1]::
436 Extracts patch and authorship information from a single
437 e-mail message, optionally transliterating the commit
440 gitlink:git-mailsplit[1]::
441 A stupid program to split UNIX mbox format mailbox into
442 individual pieces of e-mail.
444 gitlink:git-merge-tree[1]::
445 Show three-way merge without touching index.
447 gitlink:git-patch-id[1]::
448 Compute unique ID for a patch.
450 gitlink:git-parse-remote[1]::
451 Routines to help parsing `$GIT_DIR/remotes/` files.
453 gitlink:git-request-pull[1]::
456 gitlink:git-rev-parse[1]::
457 Pick out and massage parameters.
459 gitlink:git-send-email[1]::
460 Send patch e-mails out of "format-patch --mbox" output.
462 gitlink:git-symbolic-ref[1]::
463 Read and modify symbolic refs.
465 gitlink:git-stripspace[1]::
466 Filter out empty lines.
469 Commands not yet documented
470 ---------------------------
473 The gitk repository browser.
476 Configuration Mechanism
477 -----------------------
479 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
480 is used to hold per-repository configuration options. It is a
481 simple text file modeled after `.ini` format familiar to some
482 people. Here is an example:
486 # A '#' or ';' character indicates a comment.
491 ; Don't trust file modes
496 name = "Junio C Hamano"
497 email = "junkio@twinsun.com"
501 Various commands read from the configuration file and adjust
502 their operation accordingly.
505 Identifier Terminology
506 ----------------------
508 Indicates the object name for any type of object.
511 Indicates a blob object name.
514 Indicates a tree object name.
517 Indicates a commit object name.
520 Indicates a tree, commit or tag object name. A
521 command that takes a <tree-ish> argument ultimately wants to
522 operate on a <tree> object but automatically dereferences
523 <commit> and <tag> objects that point at a <tree>.
526 Indicates that an object type is required.
527 Currently one of: `blob`, `tree`, `commit`, or `tag`.
530 Indicates a filename - almost always relative to the
531 root of the tree structure `GIT_INDEX_FILE` describes.
535 Any git command accepting any <object> can also use the following
539 indicates the head of the current branch (i.e. the
540 contents of `$GIT_DIR/HEAD`).
544 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
548 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
551 File/Directory Structure
552 ------------------------
554 Please see link:repository-layout.html[repository layout] document.
556 Read link:hooks.html[hooks] for more details about each hook.
558 Higher level SCMs may provide and manage additional information in the
564 Please see link:glossary.html[glossary] document.
567 Environment Variables
568 ---------------------
569 Various git commands use the following environment variables:
573 These environment variables apply to 'all' core git commands. Nb: it
574 is worth noting that they may be used/overridden by SCMS sitting above
575 git so take care if using Cogito etc.
578 This environment allows the specification of an alternate
579 index file. If not specified, the default of `$GIT_DIR/index`
582 'GIT_OBJECT_DIRECTORY'::
583 If the object storage directory is specified via this
584 environment variable then the sha1 directories are created
585 underneath - otherwise the default `$GIT_DIR/objects`
588 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
589 Due to the immutable nature of git objects, old objects can be
590 archived into shared, read-only directories. This variable
591 specifies a ":" separated list of git object directories which
592 can be used to search for git objects. New objects will not be
593 written to these directories.
596 If the 'GIT_DIR' environment variable is set then it
597 specifies a path to use instead of the default `.git`
598 for the base of the repository.
605 'GIT_COMMITTER_NAME'::
606 'GIT_COMMITTER_EMAIL'::
607 see gitlink:git-commit-tree[1]
612 'GIT_EXTERNAL_DIFF'::
613 see the "generating patches" section in :
614 gitlink:git-diff-index[1];
615 gitlink:git-diff-files[1];
616 gitlink:git-diff-tree[1]
618 Discussion[[Discussion]]
619 ------------------------
624 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
625 * The current git nurse is Junio C Hamano <junkio@cox.net>.
626 * The git potty was written by Andres Ericsson <ae@op5.se>.
627 * General upbringing is handled by the git-list <git@vger.kernel.org>.
631 The documentation for git suite was started by David Greaves
632 <david@dgreaves.com>, and later enhanced greatly by the
633 contributors on the git-list <git@vger.kernel.org>.
637 Part of the gitlink:git[7] suite