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 available commands.
29 path to wherever your core git programs are installed.
30 This can also be controlled by setting the GIT_EXEC_PATH
31 environment variable. If no path is given 'git' will print
32 the current setting and then exit.
36 Before reading this cover to cover, you may want to take a look
37 at the link:tutorial.html[tutorial] document.
39 The <<Discussion>> section below contains much useful definition and
40 clarification info - read that first. And of the commands, I suggest
41 reading gitlink:git-update-index[1] and
42 gitlink:git-read-tree[1] first - I wish I had!
44 If you are migrating from CVS, link:cvs-migration.html[cvs migration]
45 document may be helpful after you finish the tutorial.
47 After you get the general feel from the tutorial and this
48 overview page, you may want to take a look at the
49 link:howto-index.html[howto] documents.
52 David Greaves <david@dgreaves.com>
55 Updated by Junio C Hamano <junkio@cox.net> on 2005-05-05 to
56 reflect recent changes.
60 The git commands can helpfully be split into those that manipulate
61 the repository, the index and the working fileset, those that
62 interrogate and compare them, and those that moves objects and
63 references between repositories.
65 In addition, git itself comes with a spartan set of porcelain
66 commands. They are usable but are not meant to compete with real
69 There are also some ancillary programs that can be viewed as useful
70 aids for using the core commands but which are unlikely to be used by
71 SCMs layered over git.
75 gitlink:git-apply[1]::
76 Reads a "diff -up1" or git generated patch file and
77 applies it to the working tree.
79 gitlink:git-checkout-index[1]::
80 Copy files from the index to the working directory
82 gitlink:git-commit-tree[1]::
83 Creates a new commit object
85 gitlink:git-hash-object[1]::
86 Computes the object ID from a file.
88 gitlink:git-index-pack[1]::
89 Build pack index file for an existing packed archive.
91 gitlink:git-init-db[1]::
92 Creates an empty git object database
94 gitlink:git-merge-index[1]::
95 Runs a merge for files needing merging
97 gitlink:git-mktag[1]::
100 gitlink:git-pack-objects[1]::
101 Creates a packed archive of objects.
103 gitlink:git-prune-packed[1]::
104 Remove extra objects that are already in pack files.
106 gitlink:git-read-tree[1]::
107 Reads tree information into the directory index
109 gitlink:git-unpack-objects[1]::
110 Unpacks objects out of a packed archive.
112 gitlink:git-update-index[1]::
113 Modifies the index or directory cache
115 gitlink:git-write-tree[1]::
116 Creates a tree from the current index
119 Interrogation commands
120 ~~~~~~~~~~~~~~~~~~~~~~
122 gitlink:git-cat-file[1]::
123 Provide content or type information for repository objects
125 gitlink:git-diff-index[1]::
126 Compares content and mode of blobs between the index and repository
128 gitlink:git-diff-files[1]::
129 Compares files in the working tree and the index
131 gitlink:git-diff-stages[1]::
132 Compares two "merge stages" in the index file.
134 gitlink:git-diff-tree[1]::
135 Compares the content and mode of blobs found via two tree objects
137 gitlink:git-fsck-objects[1]::
138 Verifies the connectivity and validity of the objects in the database
140 gitlink:git-ls-files[1]::
141 Information about files in the index/working directory
143 gitlink:git-ls-tree[1]::
144 Displays a tree object in human readable form
146 gitlink:git-merge-base[1]::
147 Finds as good a common ancestor as possible for a merge
149 gitlink:git-name-rev[1]::
150 Find symbolic names for given revs
152 gitlink:git-rev-list[1]::
153 Lists commit objects in reverse chronological order
155 gitlink:git-show-index[1]::
156 Displays contents of a pack idx file.
158 gitlink:git-tar-tree[1]::
159 Creates a tar archive of the files in the named tree
161 gitlink:git-unpack-file[1]::
162 Creates a temporary file with a blob's contents
165 Displays a git logical variable
167 gitlink:git-verify-pack[1]::
168 Validates packed git archive files
170 The interrogate commands may create files - and you can force them to
171 touch the working file set - but in general they don't
174 Synching repositories
175 ~~~~~~~~~~~~~~~~~~~~~
177 gitlink:git-clone-pack[1]::
178 Clones a repository into the current repository (engine
179 for ssh and local transport)
181 gitlink:git-fetch-pack[1]::
182 Updates from a remote repository.
184 gitlink:git-http-fetch[1]::
185 Downloads a remote git repository via HTTP
187 gitlink:git-local-fetch[1]::
188 Duplicates another git repository on a local system
190 gitlink:git-peek-remote[1]::
191 Lists references on a remote repository using upload-pack protocol.
193 gitlink:git-receive-pack[1]::
194 Invoked by 'git-send-pack' to receive what is pushed to it.
196 gitlink:git-send-pack[1]::
197 Pushes to a remote repository, intelligently.
199 gitlink:git-shell[1]::
200 Restricted shell for GIT-only SSH access.
202 gitlink:git-ssh-fetch[1]::
203 Pulls from a remote repository over ssh connection
205 gitlink:git-ssh-upload[1]::
206 Helper "server-side" program used by git-ssh-fetch
208 gitlink:git-update-server-info[1]::
209 Updates auxiliary information on a dumb server to help
210 clients discover references and packs on it.
212 gitlink:git-upload-pack[1]::
213 Invoked by 'git-clone-pack' and 'git-fetch-pack' to push
217 Porcelain-ish Commands
218 ----------------------
221 Add paths to the index file.
224 Apply patches from a mailbox, but cooler.
226 gitlink:git-applymbox[1]::
227 Apply patches from a mailbox.
229 gitlink:git-bisect[1]::
230 Find the change that introduced a bug.
232 gitlink:git-branch[1]::
233 Create and Show branches.
235 gitlink:git-checkout[1]::
236 Checkout and switch to a branch.
238 gitlink:git-cherry-pick[1]::
239 Cherry-pick the effect of an existing commit.
241 gitlink:git-clone[1]::
242 Clones a repository into a new directory.
244 gitlink:git-commit[1]::
245 Record changes to the repository.
247 gitlink:git-diff[1]::
248 Show changes between commits, commit and working tree, etc.
250 gitlink:git-fetch[1]::
251 Download from a remote repository via various protocols.
253 gitlink:git-format-patch[1]::
254 Prepare patches for e-mail submission.
256 gitlink:git-grep[1]::
257 Print lines matching a pattern
262 gitlink:git-ls-remote[1]::
263 Shows references in a remote or local repository.
265 gitlink:git-merge[1]::
266 Grand unified merge driver.
269 Move or rename a file, a directory, or a symlink.
271 gitlink:git-octopus[1]::
272 Merge more than two commits.
274 gitlink:git-pull[1]::
275 Fetch from and merge with a remote repository.
277 gitlink:git-push[1]::
278 Update remote refs along with associated objects.
280 gitlink:git-rebase[1]::
281 Rebase local commits to new upstream head.
283 gitlink:git-repack[1]::
284 Pack unpacked objects in a repository.
286 gitlink:git-reset[1]::
287 Reset current HEAD to the specified state.
289 gitlink:git-resolve[1]::
292 gitlink:git-revert[1]::
293 Revert an existing commit.
295 gitlink:git-shortlog[1]::
296 Summarizes 'git log' output.
298 gitlink:git-show-branch[1]::
299 Show branches and their commits.
301 gitlink:git-status[1]::
302 Shows the working tree status.
304 gitlink:git-verify-tag[1]::
305 Check the GPG signature of tag.
307 gitlink:git-whatchanged[1]::
308 Shows commit logs and differences they introduce.
315 gitlink:git-applypatch[1]::
316 Apply one patch extracted from an e-mail.
318 gitlink:git-archimport[1]::
319 Import an arch repository into git.
321 gitlink:git-convert-objects[1]::
322 Converts old-style git repository
324 gitlink:git-cvsimport[1]::
325 Salvage your data out of another SCM people love to hate.
327 gitlink:git-lost-found[1]::
328 Recover lost refs that luckily have not yet been pruned.
330 gitlink:git-merge-one-file[1]::
331 The standard helper program to use with "git-merge-index"
333 gitlink:git-prune[1]::
334 Prunes all unreachable objects from the object database
336 gitlink:git-relink[1]::
337 Hardlink common objects in local repositories.
339 gitlink:git-svnimport[1]::
340 Import a SVN repository into git.
342 gitlink:git-sh-setup[1]::
343 Common git shell script setup code.
345 gitlink:git-symbolic-ref[1]::
346 Read and modify symbolic refs
349 An example script to create a tag object signed with GPG
351 gitlink:git-update-ref[1]::
352 Update the object name stored in a ref safely.
357 gitlink:git-check-ref-format[1]::
358 Make sure ref name is well formed.
360 gitlink:git-cherry[1]::
361 Find commits not merged upstream.
363 gitlink:git-count-objects[1]::
364 Count unpacked number of objects and their disk consumption.
366 gitlink:git-daemon[1]::
367 A really simple server for git repositories.
369 gitlink:git-get-tar-commit-id[1]::
370 Extract commit ID from an archive created using git-tar-tree.
372 gitlink:git-mailinfo[1]::
373 Extracts patch from a single e-mail message.
375 gitlink:git-mailsplit[1]::
378 gitlink:git-patch-id[1]::
379 Compute unique ID for a patch.
381 gitlink:git-parse-remote[1]::
382 Routines to help parsing $GIT_DIR/remotes/
384 gitlink:git-request-pull[1]::
387 gitlink:git-rev-parse[1]::
388 Pick out and massage parameters.
390 gitlink:git-send-email[1]::
391 Send patch e-mails out of "format-patch --mbox" output.
393 gitlink:git-symbolic-refs[1]::
394 Read and modify symbolic refs.
396 gitlink:git-stripspace[1]::
397 Filter out empty lines.
400 Commands not yet documented
401 ---------------------------
407 Configuration Mechanism
408 -----------------------
410 Starting from 0.99.9 (actually mid 0.99.8.GIT), .git/config file
411 is used to hold per-repository configuration options. It is a
412 simple text file modelled after `.ini` format familiar to some
413 people. Here is an example:
417 # This is the config file, and
418 # a '#' or ';' character indicates
424 ; Don't trust file modes
429 name = "Junio C Hamano"
430 email = "junkio@twinsun.com"
434 Various commands read from the configuration file and adjust
435 their operation accordingly.
438 Identifier Terminology
439 ----------------------
441 Indicates the sha1 identifier for any type of object
444 Indicates a blob object sha1 identifier
447 Indicates a tree object sha1 identifier
450 Indicates a commit object sha1 identifier
453 Indicates a tree, commit or tag object sha1 identifier. A
454 command that takes a <tree-ish> argument ultimately wants to
455 operate on a <tree> object but automatically dereferences
456 <commit> and <tag> objects that point at a <tree>.
459 Indicates that an object type is required.
460 Currently one of: blob/tree/commit/tag
463 Indicates a filename - always relative to the root of
464 the tree structure GIT_INDEX_FILE describes.
468 Any git command accepting any <object> can also use the following
472 indicates the head of the repository (ie the contents of
476 (ie the contents of `$GIT_DIR/refs/tags/<tag>`)
479 (ie the contents of `$GIT_DIR/refs/heads/<head>`)
481 a valid snapshot 'name'+
482 (ie the contents of `$GIT_DIR/refs/snap/<snap>`)
485 File/Directory Structure
486 ------------------------
488 Please see link:repository-layout.html[repository layout] document.
490 Higher level SCMs may provide and manage additional information in the
496 Please see link:glossary.html[glossary] document.
499 Environment Variables
500 ---------------------
501 Various git commands use the following environment variables:
505 These environment variables apply to 'all' core git commands. Nb: it
506 is worth noting that they may be used/overridden by SCMS sitting above
507 git so take care if using Cogito etc
510 This environment allows the specification of an alternate
511 index file. If not specified, the default of `$GIT_DIR/index`
514 'GIT_OBJECT_DIRECTORY'::
515 If the object storage directory is specified via this
516 environment variable then the sha1 directories are created
517 underneath - otherwise the default `$GIT_DIR/objects`
520 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
521 Due to the immutable nature of git objects, old objects can be
522 archived into shared, read-only directories. This variable
523 specifies a ":" separated list of git object directories which
524 can be used to search for git objects. New objects will not be
525 written to these directories.
528 If the 'GIT_DIR' environment variable is set then it specifies
529 a path to use instead of `./.git` for the base of the
537 'GIT_COMMITTER_NAME'::
538 'GIT_COMMITTER_EMAIL'::
539 see gitlink:git-commit-tree[1]
544 'GIT_EXTERNAL_DIFF'::
545 see the "generating patches" section in :
546 gitlink:git-diff-index[1];
547 gitlink:git-diff-files[1];
548 gitlink:git-diff-tree[1]
550 Discussion[[Discussion]]
551 ------------------------
556 git's founding father is Linus Torvalds <torvalds@osdl.org>.
557 The current git nurse is Junio C. Hamano <junkio@cox.net>.
558 The git potty was written by Andres Ericsson <ae@op5.se>.
559 General upbringing is handled by the git-list <git@vger.kernel.org>.
563 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
567 Part of the gitlink:git[7] suite