7 git - the stupid content tracker
12 'git-<command>' <args>
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-cache.html[git-update-cache] 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>
38 Updated by Junio C Hamano <junkio@cox.net> on 2005-05-05 to
39 reflect recent changes.
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
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.
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-cache.html[git-checkout-cache]::
63 Copy files from the cache to the working directory
65 link:git-commit-tree.html[git-commit-tree]::
66 Creates a new commit object
68 link:git-hash-object.html[git-hash-object]::
69 Computes the object ID from a file.
71 link:git-init-db.html[git-init-db]::
72 Creates an empty git object database
74 link:git-merge-cache.html[git-merge-cache]::
75 Runs a merge for files needing merging
77 link:git-mktag.html[git-mktag]::
80 link:git-pack-objects.html[git-pack-objects]::
81 Creates a packed archive of objects.
83 link:git-prune-packed.html[git-prune-packed]::
84 Remove extra objects that are already in pack files.
86 link:git-read-tree.html[git-read-tree]::
87 Reads tree information into the directory cache
89 link:git-unpack-objects.html[git-unpack-objects]::
90 Unpacks objects out of a packed archive.
92 link:git-update-cache.html[git-update-cache]::
93 Modifies the index or directory cache
95 link:git-write-tree.html[git-write-tree]::
96 Creates a tree from the current cache
99 Interrogation commands
100 ~~~~~~~~~~~~~~~~~~~~~~
102 link:git-cat-file.html[git-cat-file]::
103 Provide content or type information for repository objects
105 link:git-diff-cache.html[git-diff-cache]::
106 Compares content and mode of blobs between the cache and repository
108 link:git-diff-files.html[git-diff-files]::
109 Compares files in the working tree and the cache
111 link:git-diff-stages.html[git-diff-stages]::
112 Compares two "merge stages" in the index file.
114 link:git-diff-tree.html[git-diff-tree]::
115 Compares the content and mode of blobs found via two tree objects
117 link:git-export.html[git-export]::
118 Exports each commit and a diff against each of its parents
120 link:git-fsck-cache.html[git-fsck-cache]::
121 Verifies the connectivity and validity of the objects in the database
123 link:git-ls-files.html[git-ls-files]::
124 Information about files in the cache/working directory
126 link:git-ls-tree.html[git-ls-tree]::
127 Displays a tree object in human readable form
129 link:git-merge-base.html[git-merge-base]::
130 Finds as good a common ancestor as possible for a merge
132 link:git-rev-list.html[git-rev-list]::
133 Lists commit objects in reverse chronological order
135 link:git-rev-tree.html[git-rev-tree]::
136 Provides the revision tree for one or more commits
138 link:git-show-index.html[git-show-index]::
139 Displays contents of a pack idx file.
141 link:git-tar-tree.html[git-tar-tree]::
142 Creates a tar archive of the files in the named tree
144 link:git-unpack-file.html[git-unpack-file]::
145 Creates a temporary file with a blob's contents
147 link:git-var.html[git-var]::
148 Displays a git logical variable
150 link:git-verify-pack.html[git-verify-pack]::
151 Validates packed GIT archive files
153 The interrogate commands may create files - and you can force them to
154 touch the working file set - but in general they don't
157 Synching repositories
158 ~~~~~~~~~~~~~~~~~~~~~
160 link:git-clone-pack.html[git-clone-pack]::
161 Clones a repository into the current repository (engine
162 for ssh and local transport)
164 link:git-fetch-pack.html[git-fetch-pack]::
165 Updates from a remote repository.
167 link:git-http-pull.html[git-http-pull]::
168 Downloads a remote GIT repository via HTTP
170 link:git-local-pull.html[git-local-pull]::
171 Duplicates another GIT repository on a local system
173 link:git-peek-remote.html[git-peek-remote]::
174 Lists references on a remote repository using upload-pack protocol.
176 link:git-receive-pack.html[git-receive-pack]::
177 Invoked by 'git-send-pack' to receive what is pushed to it.
179 link:git-send-pack.html[git-send-pack]::
180 Pushes to a remote repository, intelligently.
182 link:git-ssh-pull.html[git-ssh-pull]::
183 Pulls from a remote repository over ssh connection
185 link:git-ssh-push.html[git-ssh-push]::
186 Helper "server-side" program used by git-ssh-pull
188 link:git-update-server-info.html[git-update-server-info]::
189 Updates auxiliary information on a dumb server to help
190 clients discover references and packs on it.
192 link:git-upload-pack.html[git-upload-pack]::
193 Invoked by 'git-clone-pack' and 'git-fetch-pack' to push
197 Porcelain-ish Commands
198 ----------------------
200 link:git-add-script.html[git-add-script]::
201 Add paths to the index file.
203 link:git-applymbox.html[git-applymbox]::
204 Apply patches from a mailbox.
206 link:git-bisect-script.html[git-bisect-script]::
207 Find the change that introduced a bug.
209 link:git-branch-script.html[git-branch-script]::
210 Create and Show branches.
212 link:git-cherry-pick-script.html[git-cherry-pick-script]::
213 Cherry-pick the effect of an existing commit.
215 link:git-clone-script.html[git-clone-script]::
216 Clones a repository into a new directory.
218 link:git-commit-script.html[git-commit-script]::
219 Record changes to the repository.
221 link:git-fetch-script.html[git-fetch-script]::
222 Download from a remote repository via various protocols.
224 link:git-log-script.html[git-log-script]::
227 link:git-ls-remote-script.html[git-ls-remote-script]::
228 Shows references in a remote or local repository.
230 link:git-octopus-script.html[git-octopus-script]::
231 Merge more than two commits.
233 link:git-pull-script.html[git-pull-script]::
234 Fetch from and merge with a remote repository.
236 link:git-push-script.html[git-push-script]::
237 Update remote refs along with associated objects.
239 link:git-rebase-script.html[git-rebase-script]::
240 Rebase local commits to new upstream head.
242 link:git-rename-script.html[git-rename]::
243 Rename files and directories.
245 link:git-repack-script.html[git-repack-script]::
246 Pack unpacked objects in a repository.
248 link:git-resolve-script.html[git-resolve-script]::
251 link:git-revert-script.html[git-revert-script]::
252 Revert an existing commit.
254 link:git-shortlog.html[git-shortlog]::
255 Summarizes 'git log' output.
257 link:git-show-branch.html[git-show-branch]::
258 Show branches and their commits.
260 link:git-status-script.html[git-status-script]::
261 Shows the working tree status.
263 link:git-verify-tag-script.html[git-verify-tag-script]::
264 Check the GPG signature of tag.
266 link:git-whatchanged.html[git-whatchanged]::
267 Shows commit logs and differences they introduce.
274 link:git-applypatch.html[git-applypatch]::
275 Apply one patch extracted from an e-mail.
277 link:git-archimport-script.html[git-archimport-script]::
278 Import an arch repository into git.
280 link:git-convert-cache.html[git-convert-cache]::
281 Converts old-style GIT repository
283 link:git-cvsimport-script.html[git-cvsimport-script]::
284 Salvage your data out of another SCM people love to hate.
286 link:git-merge-one-file-script.html[git-merge-one-file-script]::
287 The standard helper program to use with "git-merge-cache"
289 link:git-prune-script.html[git-prune-script]::
290 Prunes all unreachable objects from the object database
292 link:git-relink-script.html[git-relink-script]::
293 Hardlink common objects in local repositories.
295 link:git-sh-setup-script.html[git-sh-setup-script]::
296 Common git shell script setup code.
298 link:git-tag-script.html[git-tag-script]::
299 An example script to create a tag object signed with GPG
304 link:git-cherry.html[git-cherry]::
305 Find commits not merged upstream.
307 link:git-count-objects-script.html[git-count-objects-script]::
308 Count unpacked number of objects and their disk consumption.
310 link:git-daemon.html[git-daemon]::
311 A really simple server for GIT repositories.
313 link:git-diff-helper.html[git-diff-helper]::
314 Generates patch format output for git-diff-*
316 link:git-get-tar-commit-id.html[git-get-tar-commit-id]::
317 Extract commit ID from an archive created using git-tar-tree.
319 link:git-mailinfo.html[git-mailinfo]::
320 Extracts patch from a single e-mail message.
322 link:git-mailsplit.html[git-mailsplit]::
325 link:git-patch-id.html[git-patch-id]::
326 Compute unique ID for a patch.
328 link:git-parse-remote-script.html[git-parse-remote-script]::
329 Routines to help parsing $GIT_DIR/remotes/
331 link:git-request-pull-script.html[git-request-pull-script]::
332 git-request-pull-script.
334 link:git-rev-parse.html[git-rev-parse]::
335 Pick out and massage parameters.
337 link:git-send-email-script.html[git-send-email]::
338 Send patch e-mails out of "format-patch --mbox" output.
340 Commands not yet documented
341 ---------------------------
343 link:git-build-rev-cache.html[git-build-rev-cache]::
346 link:git-checkout-script.html[git-checkout-script]::
349 link:git-diff-script.html[git-diff-script]::
352 link:git-format-patch-script.html[git-format-patch-script]::
353 git-format-patch-script.
355 link:git-reset-script.html[git-reset-script]::
358 link:git-show-rev-cache.html[git-show-rev-cache]::
361 link:git-stripspace.html[git-stripspace]::
364 link:gitk.html[gitk]::
368 Identifier Terminology
369 ----------------------
371 Indicates the sha1 identifier for any type of object
374 Indicates a blob object sha1 identifier
377 Indicates a tree object sha1 identifier
380 Indicates a commit object sha1 identifier
383 Indicates a tree, commit or tag object sha1 identifier. A
384 command that takes a <tree-ish> argument ultimately wants to
385 operate on a <tree> object but automatically dereferences
386 <commit> and <tag> objects that point at a <tree>.
389 Indicates that an object type is required.
390 Currently one of: blob/tree/commit/tag
393 Indicates a filename - always relative to the root of
394 the tree structure GIT_INDEX_FILE describes.
398 Any git command accepting any <object> can also use the following
402 indicates the head of the repository (ie the contents of
406 (ie the contents of `$GIT_DIR/refs/tags/<tag>`)
409 (ie the contents of `$GIT_DIR/refs/heads/<head>`)
411 a valid snapshot 'name'+
412 (ie the contents of `$GIT_DIR/refs/snap/<snap>`)
415 File/Directory Structure
416 ------------------------
418 Please see link:repository-layout.html[repository layout] document.
420 Higher level SCMs may provide and manage additional information in the
426 Please see link:glossary.html[glossary] document.
429 Environment Variables
430 ---------------------
431 Various git commands use the following environment variables:
435 These environment variables apply to 'all' core git commands. Nb: it
436 is worth noting that they may be used/overridden by SCMS sitting above
437 git so take care if using Cogito etc
440 This environment allows the specification of an alternate
441 cache/index file. If not specified, the default of
442 `$GIT_DIR/index` is used.
444 'GIT_OBJECT_DIRECTORY'::
445 If the object storage directory is specified via this
446 environment variable then the sha1 directories are created
447 underneath - otherwise the default `$GIT_DIR/objects`
450 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
451 Due to the immutable nature of git objects, old objects can be
452 archived into shared, read-only directories. This variable
453 specifies a ":" separated list of git object directories which
454 can be used to search for git objects. New objects will not be
455 written to these directories.
458 If the 'GIT_DIR' environment variable is set then it specifies
459 a path to use instead of `./.git` for the base of the
467 'GIT_COMMITTER_NAME'::
468 'GIT_COMMITTER_EMAIL'::
469 see link:git-commit-tree.html[git-commit-tree]
474 'GIT_EXTERNAL_DIFF'::
475 see the "generating patches" section in :
476 link:git-diff-cache.html[git-diff-cache];
477 link:git-diff-files.html[git-diff-files];
478 link:git-diff-tree.html[git-diff-tree]
480 Discussion[[Discussion]]
481 ------------------------
486 Written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>.
490 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
494 Part of the link:git.html[git] suite