6 git - the stupid content tracker
12 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
13 [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]
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.
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].
26 The COMMAND is either a name of a Git command (see below) or an alias
27 as defined in the configuration file (see gitlink:git-repo-config[1]).
32 Prints the git suite version that the 'git' program came from.
35 Prints the synopsis and a list of the most commonly used
36 commands. If a git command is named this option will bring up
37 the man-page for that command. If the option '--all' or '-a' is
38 given then all available commands are printed.
41 Path to wherever your core git programs are installed.
42 This can also be controlled by setting the GIT_EXEC_PATH
43 environment variable. If no path is given 'git' will print
44 the current setting and then exit.
47 Pipe all output into 'less' (or if set, $PAGER).
50 Set the path to the repository. This can also be controlled by
51 setting the GIT_DIR environment variable.
54 Same as --git-dir=`pwd`.
59 See the references above to get started using git. The following is
60 probably more detail than necessary for a first-time user.
62 The <<Discussion,Discussion>> section below and the
63 link:core-tutorial.html[Core tutorial] both provide introductions to the
64 underlying git architecture.
66 See also the link:howto-index.html[howto] documents for some useful
72 We divide git into high level ("porcelain") commands and low level
73 ("plumbing") commands.
75 High-level commands (porcelain)
76 -------------------------------
78 We separate the porcelain commands into the main commands and some
79 ancillary user utilities.
81 Main porcelain commands
82 ~~~~~~~~~~~~~~~~~~~~~~~
85 Add paths to the index.
88 Apply patches from a mailbox, but cooler.
90 gitlink:git-applymbox[1]::
91 Apply patches from a mailbox, original version by Linus.
93 gitlink:git-archive[1]::
94 Creates an archive of files from a named tree.
96 gitlink:git-bisect[1]::
97 Find the change that introduced a bug by binary search.
99 gitlink:git-branch[1]::
100 Create and Show branches.
102 gitlink:git-checkout[1]::
103 Checkout and switch to a branch.
105 gitlink:git-cherry-pick[1]::
106 Cherry-pick the effect of an existing commit.
108 gitlink:git-clean[1]::
109 Remove untracked files from the working tree.
111 gitlink:git-clone[1]::
112 Clones a repository into a new directory.
114 gitlink:git-commit[1]::
115 Record changes to the repository.
117 gitlink:git-diff[1]::
118 Show changes between commits, commit and working tree, etc.
120 gitlink:git-fetch[1]::
121 Download from a remote repository via various protocols.
123 gitlink:git-format-patch[1]::
124 Prepare patches for e-mail submission.
126 gitlink:git-grep[1]::
127 Print lines matching a pattern.
130 The git repository browser.
135 gitlink:git-ls-remote[1]::
136 Shows references in a remote or local repository.
138 gitlink:git-merge[1]::
139 Grand unified merge driver.
142 Move or rename a file, a directory, or a symlink.
144 gitlink:git-pack-refs[1]::
145 Pack heads and tags for efficient repository access.
147 gitlink:git-pull[1]::
148 Fetch from and merge with a remote repository or a local branch.
150 gitlink:git-push[1]::
151 Update remote refs along with associated objects.
153 gitlink:git-rebase[1]::
154 Rebase local commits to the updated upstream head.
156 gitlink:git-repack[1]::
157 Pack unpacked objects in a repository.
159 gitlink:git-rerere[1]::
160 Reuse recorded resolution of conflicted merges.
162 gitlink:git-reset[1]::
163 Reset current HEAD to the specified state.
165 gitlink:git-resolve[1]::
168 gitlink:git-revert[1]::
169 Revert an existing commit.
172 Remove files from the working tree and from the index.
174 gitlink:git-shortlog[1]::
175 Summarizes 'git log' output.
177 gitlink:git-show[1]::
178 Show one commit log and its diff.
180 gitlink:git-show-branch[1]::
181 Show branches and their commits.
183 gitlink:git-status[1]::
184 Shows the working tree status.
186 gitlink:git-verify-tag[1]::
187 Check the GPG signature of tag.
189 gitlink:git-whatchanged[1]::
190 Shows commit logs and differences they introduce.
197 gitlink:git-applypatch[1]::
198 Apply one patch extracted from an e-mail.
200 gitlink:git-archimport[1]::
201 Import an arch repository into git.
203 gitlink:git-convert-objects[1]::
204 Converts old-style git repository.
206 gitlink:git-cvsimport[1]::
207 Salvage your data out of another SCM people love to hate.
209 gitlink:git-cvsexportcommit[1]::
210 Export a single commit to a CVS checkout.
212 gitlink:git-cvsserver[1]::
213 A CVS server emulator for git.
215 gitlink:git-lost-found[1]::
216 Recover lost refs that luckily have not yet been pruned.
218 gitlink:git-merge-one-file[1]::
219 The standard helper program to use with `git-merge-index`.
221 gitlink:git-prune[1]::
222 Prunes all unreachable objects from the object database.
224 gitlink:git-quiltimport[1]::
225 Applies a quilt patchset onto the current branch.
227 gitlink:git-relink[1]::
228 Hardlink common objects in local repositories.
231 Bidirectional operation between a single Subversion branch and git.
233 gitlink:git-svnimport[1]::
234 Import a SVN repository into git.
236 gitlink:git-sh-setup[1]::
237 Common git shell script setup code.
239 gitlink:git-symbolic-ref[1]::
240 Read and modify symbolic refs.
243 An example script to create a tag object signed with GPG.
245 gitlink:git-update-ref[1]::
246 Update the object name stored in a ref safely.
251 gitlink:git-annotate[1]::
252 Annotate file lines with commit info.
254 gitlink:git-blame[1]::
255 Find out where each line in a file came from.
257 gitlink:git-check-ref-format[1]::
258 Make sure ref name is well formed.
260 gitlink:git-cherry[1]::
261 Find commits not merged upstream.
263 gitlink:git-count-objects[1]::
264 Count unpacked number of objects and their disk consumption.
266 gitlink:git-daemon[1]::
267 A really simple server for git repositories.
269 gitlink:git-fmt-merge-msg[1]::
270 Produce a merge commit message.
272 gitlink:git-get-tar-commit-id[1]::
273 Extract commit ID from an archive created using git-tar-tree.
275 gitlink:git-imap-send[1]::
276 Dump a mailbox from stdin into an imap folder.
278 gitlink:git-instaweb[1]::
279 Instantly browse your working repository in gitweb.
281 gitlink:git-mailinfo[1]::
282 Extracts patch and authorship information from a single
283 e-mail message, optionally transliterating the commit
286 gitlink:git-mailsplit[1]::
287 A stupid program to split UNIX mbox format mailbox into
288 individual pieces of e-mail.
290 gitlink:git-merge-tree[1]::
291 Show three-way merge without touching index.
293 gitlink:git-patch-id[1]::
294 Compute unique ID for a patch.
296 gitlink:git-parse-remote[1]::
297 Routines to help parsing `$GIT_DIR/remotes/` files.
299 gitlink:git-request-pull[1]::
302 gitlink:git-rev-parse[1]::
303 Pick out and massage parameters.
305 gitlink:git-send-email[1]::
306 Send patch e-mails out of "format-patch --mbox" output.
308 gitlink:git-symbolic-ref[1]::
309 Read and modify symbolic refs.
311 gitlink:git-stripspace[1]::
312 Filter out empty lines.
315 Low-level commands (plumbing)
316 -----------------------------
318 Although git includes its
319 own porcelain layer, its low-level commands are sufficient to support
320 development of alternative porcelains. Developers of such porcelains
321 might start by reading about gitlink:git-update-index[1] and
322 gitlink:git-read-tree[1].
324 We divide the low-level commands into commands that manipulate objects (in
325 the repository, index, and working tree), commands that interrogate and
326 compare objects, and commands that move objects and references between
329 Manipulation commands
330 ~~~~~~~~~~~~~~~~~~~~~
331 gitlink:git-apply[1]::
332 Reads a "diff -up1" or git generated patch file and
333 applies it to the working tree.
335 gitlink:git-checkout-index[1]::
336 Copy files from the index to the working tree.
338 gitlink:git-commit-tree[1]::
339 Creates a new commit object.
341 gitlink:git-hash-object[1]::
342 Computes the object ID from a file.
344 gitlink:git-index-pack[1]::
345 Build pack idx file for an existing packed archive.
347 gitlink:git-init-db[1]::
348 Creates an empty git object database, or reinitialize an
351 gitlink:git-merge-index[1]::
352 Runs a merge for files needing merging.
354 gitlink:git-mktag[1]::
355 Creates a tag object.
357 gitlink:git-mktree[1]::
358 Build a tree-object from ls-tree formatted text.
360 gitlink:git-pack-objects[1]::
361 Creates a packed archive of objects.
363 gitlink:git-prune-packed[1]::
364 Remove extra objects that are already in pack files.
366 gitlink:git-read-tree[1]::
367 Reads tree information into the index.
369 gitlink:git-repo-config[1]::
370 Get and set options in .git/config.
372 gitlink:git-unpack-objects[1]::
373 Unpacks objects out of a packed archive.
375 gitlink:git-update-index[1]::
376 Registers files in the working tree to the index.
378 gitlink:git-write-tree[1]::
379 Creates a tree from the index.
382 Interrogation commands
383 ~~~~~~~~~~~~~~~~~~~~~~
385 gitlink:git-cat-file[1]::
386 Provide content or type/size information for repository objects.
388 gitlink:git-describe[1]::
389 Show the most recent tag that is reachable from a commit.
391 gitlink:git-diff-index[1]::
392 Compares content and mode of blobs between the index and repository.
394 gitlink:git-diff-files[1]::
395 Compares files in the working tree and the index.
397 gitlink:git-diff-stages[1]::
398 Compares two "merge stages" in the index.
400 gitlink:git-diff-tree[1]::
401 Compares the content and mode of blobs found via two tree objects.
403 gitlink:git-for-each-ref[1]::
404 Output information on each ref.
406 gitlink:git-fsck-objects[1]::
407 Verifies the connectivity and validity of the objects in the database.
409 gitlink:git-ls-files[1]::
410 Information about files in the index and the working tree.
412 gitlink:git-ls-tree[1]::
413 Displays a tree object in human readable form.
415 gitlink:git-merge-base[1]::
416 Finds as good common ancestors as possible for a merge.
418 gitlink:git-name-rev[1]::
419 Find symbolic names for given revs.
421 gitlink:git-pack-redundant[1]::
422 Find redundant pack files.
424 gitlink:git-rev-list[1]::
425 Lists commit objects in reverse chronological order.
427 gitlink:git-show-index[1]::
428 Displays contents of a pack idx file.
430 gitlink:git-show-ref[1]::
431 List references in a local repository.
433 gitlink:git-tar-tree[1]::
434 Creates a tar archive of the files in the named tree object.
436 gitlink:git-unpack-file[1]::
437 Creates a temporary file with a blob's contents.
440 Displays a git logical variable.
442 gitlink:git-verify-pack[1]::
443 Validates packed git archive files.
445 In general, the interrogate commands do not touch the files in
449 Synching repositories
450 ~~~~~~~~~~~~~~~~~~~~~
452 gitlink:git-fetch-pack[1]::
453 Updates from a remote repository (engine for ssh and
456 gitlink:git-http-fetch[1]::
457 Downloads a remote git repository via HTTP by walking
460 gitlink:git-local-fetch[1]::
461 Duplicates another git repository on a local system by
462 walking commit chain.
464 gitlink:git-peek-remote[1]::
465 Lists references on a remote repository using
466 upload-pack protocol (engine for ssh and local
469 gitlink:git-receive-pack[1]::
470 Invoked by 'git-send-pack' to receive what is pushed to it.
472 gitlink:git-send-pack[1]::
473 Pushes to a remote repository, intelligently.
475 gitlink:git-http-push[1]::
476 Push missing objects using HTTP/DAV.
478 gitlink:git-shell[1]::
479 Restricted shell for GIT-only SSH access.
481 gitlink:git-ssh-fetch[1]::
482 Pulls from a remote repository over ssh connection by
483 walking commit chain.
485 gitlink:git-ssh-upload[1]::
486 Helper "server-side" program used by git-ssh-fetch.
488 gitlink:git-update-server-info[1]::
489 Updates auxiliary information on a dumb server to help
490 clients discover references and packs on it.
492 gitlink:git-upload-archive[1]::
493 Invoked by 'git-archive' to send a generated archive.
495 gitlink:git-upload-pack[1]::
496 Invoked by 'git-fetch-pack' to push
500 Configuration Mechanism
501 -----------------------
503 Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
504 is used to hold per-repository configuration options. It is a
505 simple text file modeled after `.ini` format familiar to some
506 people. Here is an example:
510 # A '#' or ';' character indicates a comment.
515 ; Don't trust file modes
520 name = "Junio C Hamano"
521 email = "junkio@twinsun.com"
525 Various commands read from the configuration file and adjust
526 their operation accordingly.
529 Identifier Terminology
530 ----------------------
532 Indicates the object name for any type of object.
535 Indicates a blob object name.
538 Indicates a tree object name.
541 Indicates a commit object name.
544 Indicates a tree, commit or tag object name. A
545 command that takes a <tree-ish> argument ultimately wants to
546 operate on a <tree> object but automatically dereferences
547 <commit> and <tag> objects that point at a <tree>.
550 Indicates that an object type is required.
551 Currently one of: `blob`, `tree`, `commit`, or `tag`.
554 Indicates a filename - almost always relative to the
555 root of the tree structure `GIT_INDEX_FILE` describes.
559 Any git command accepting any <object> can also use the following
563 indicates the head of the current branch (i.e. the
564 contents of `$GIT_DIR/HEAD`).
568 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
572 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
574 For a more complete list of ways to spell object names, see
575 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
578 File/Directory Structure
579 ------------------------
581 Please see link:repository-layout.html[repository layout] document.
583 Read link:hooks.html[hooks] for more details about each hook.
585 Higher level SCMs may provide and manage additional information in the
591 Please see link:glossary.html[glossary] document.
594 Environment Variables
595 ---------------------
596 Various git commands use the following environment variables:
600 These environment variables apply to 'all' core git commands. Nb: it
601 is worth noting that they may be used/overridden by SCMS sitting above
602 git so take care if using Cogito etc.
605 This environment allows the specification of an alternate
606 index file. If not specified, the default of `$GIT_DIR/index`
609 'GIT_OBJECT_DIRECTORY'::
610 If the object storage directory is specified via this
611 environment variable then the sha1 directories are created
612 underneath - otherwise the default `$GIT_DIR/objects`
615 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
616 Due to the immutable nature of git objects, old objects can be
617 archived into shared, read-only directories. This variable
618 specifies a ":" separated list of git object directories which
619 can be used to search for git objects. New objects will not be
620 written to these directories.
623 If the 'GIT_DIR' environment variable is set then it
624 specifies a path to use instead of the default `.git`
625 for the base of the repository.
632 'GIT_COMMITTER_NAME'::
633 'GIT_COMMITTER_EMAIL'::
634 see gitlink:git-commit-tree[1]
639 'GIT_EXTERNAL_DIFF'::
640 see the "generating patches" section in :
641 gitlink:git-diff-index[1];
642 gitlink:git-diff-files[1];
643 gitlink:git-diff-tree[1]
648 This environment variable overrides `$PAGER`.
651 If this variable is set to "1", "2" or "true" (comparison
652 is case insensitive), git will print `trace:` messages on
653 stderr telling about alias expansion, built-in command
654 execution and external command execution.
655 If this variable is set to an integer value greater than 1
656 and lower than 10 (strictly) then git will interpret this
657 value as an open file descriptor and will try to write the
658 trace messages into this file descriptor.
659 Alternatively, if this variable is set to an absolute path
660 (starting with a '/' character), git will interpret this
661 as a file path and will try to write the trace messages
664 Discussion[[Discussion]]
665 ------------------------
670 * git's founding father is Linus Torvalds <torvalds@osdl.org>.
671 * The current git nurse is Junio C Hamano <junkio@cox.net>.
672 * The git potty was written by Andres Ericsson <ae@op5.se>.
673 * General upbringing is handled by the git-list <git@vger.kernel.org>.
677 The documentation for git suite was started by David Greaves
678 <david@dgreaves.com>, and later enhanced greatly by the
679 contributors on the git-list <git@vger.kernel.org>.
683 Part of the gitlink:git[7] suite