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 gitlink:git-update-index[1] and
25 gitlink:git-read-tree[1] 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 gitlink:git-apply[1]::
59 Reads a "diff -up1" or git generated patch file and
60 applies it to the working tree.
62 gitlink:git-checkout-index[1]::
63 Copy files from the cache to the working directory
64 Previously this command was known as git-checkout-cache.
66 gitlink:git-commit-tree[1]::
67 Creates a new commit object
69 gitlink:git-hash-object[1]::
70 Computes the object ID from a file.
72 gitlink:git-init-db[1]::
73 Creates an empty git object database
75 gitlink:git-merge-index[1]::
76 Runs a merge for files needing merging
77 Previously this command was known as git-merge-cache.
79 gitlink:git-mktag[1]::
82 gitlink:git-pack-objects[1]::
83 Creates a packed archive of objects.
85 gitlink:git-prune-packed[1]::
86 Remove extra objects that are already in pack files.
88 gitlink:git-read-tree[1]::
89 Reads tree information into the directory cache
91 gitlink:git-unpack-objects[1]::
92 Unpacks objects out of a packed archive.
94 gitlink:git-update-index[1]::
95 Modifies the index or directory cache
96 Previously this command was known as git-update-cache.
98 gitlink:git-write-tree[1]::
99 Creates a tree from the current cache
102 Interrogation commands
103 ~~~~~~~~~~~~~~~~~~~~~~
105 gitlink:git-cat-file[1]::
106 Provide content or type information for repository objects
108 gitlink:git-diff-index[1]::
109 Compares content and mode of blobs between the cache and repository
110 Previously this command was known as git-diff-cache.
112 gitlink:git-diff-files[1]::
113 Compares files in the working tree and the cache
115 gitlink:git-diff-stages[1]::
116 Compares two "merge stages" in the index file.
118 gitlink:git-diff-tree[1]::
119 Compares the content and mode of blobs found via two tree objects
121 gitlink:git-export[1]::
122 Exports each commit and a diff against each of its parents
124 gitlink:git-fsck-objects[1]::
125 Verifies the connectivity and validity of the objects in the database
126 Previously this command was known as git-fsck-cache.
128 gitlink:git-ls-files[1]::
129 Information about files in the cache/working directory
131 gitlink:git-ls-tree[1]::
132 Displays a tree object in human readable form
134 gitlink:git-merge-base[1]::
135 Finds as good a common ancestor as possible for a merge
137 gitlink:git-rev-list[1]::
138 Lists commit objects in reverse chronological order
140 gitlink:git-rev-tree[1]::
141 Provides the revision tree for one or more commits
143 gitlink:git-show-index[1]::
144 Displays contents of a pack idx file.
146 gitlink:git-tar-tree[1]::
147 Creates a tar archive of the files in the named tree
149 gitlink:git-unpack-file[1]::
150 Creates a temporary file with a blob's contents
153 Displays a git logical variable
155 gitlink:git-verify-pack[1]::
156 Validates packed GIT archive files
158 The interrogate commands may create files - and you can force them to
159 touch the working file set - but in general they don't
162 Synching repositories
163 ~~~~~~~~~~~~~~~~~~~~~
165 gitlink:git-clone-pack[1]::
166 Clones a repository into the current repository (engine
167 for ssh and local transport)
169 gitlink:git-fetch-pack[1]::
170 Updates from a remote repository.
172 gitlink:git-http-fetch[1]::
173 Downloads a remote GIT repository via HTTP
174 Previously this command was known as git-http-pull.
176 gitlink:git-local-fetch[1]::
177 Duplicates another GIT repository on a local system
178 Previously this command was known as git-local-pull.
180 gitlink:git-peek-remote[1]::
181 Lists references on a remote repository using upload-pack protocol.
183 gitlink:git-receive-pack[1]::
184 Invoked by 'git-send-pack' to receive what is pushed to it.
186 gitlink:git-send-pack[1]::
187 Pushes to a remote repository, intelligently.
189 gitlink:git-ssh-fetch[1]::
190 Pulls from a remote repository over ssh connection
191 Previously this command was known as git-ssh-pull.
193 gitlink:git-ssh-upload[1]::
194 Helper "server-side" program used by git-ssh-fetch
195 Previously this command was known as git-ssh-push.
197 gitlink:git-update-server-info[1]::
198 Updates auxiliary information on a dumb server to help
199 clients discover references and packs on it.
201 gitlink:git-upload-pack[1]::
202 Invoked by 'git-clone-pack' and 'git-fetch-pack' to push
206 Porcelain-ish Commands
207 ----------------------
210 Add paths to the index file.
211 Previously this command was known as git-add-script.
213 gitlink:git-applymbox[1]::
214 Apply patches from a mailbox.
216 gitlink:git-bisect[1]::
217 Find the change that introduced a bug.
218 Previously this command was known as git-bisect-script.
220 gitlink:git-branch[1]::
221 Create and Show branches.
222 Previously this command was known as git-branch-script.
224 gitlink:git-checkout[1]::
225 Checkout and switch to a branch.
226 Previously this command was known as git-checkout-script.
228 gitlink:git-cherry-pick[1]::
229 Cherry-pick the effect of an existing commit.
230 Previously this command was known as git-cherry-pick-script.
232 gitlink:git-clone[1]::
233 Clones a repository into a new directory.
234 Previously this command was known as git-clone-script.
236 gitlink:git-commit[1]::
237 Record changes to the repository.
238 Previously this command was known as git-commit-script.
240 gitlink:git-diff[1]::
241 Show changes between commits, commit and working tree, etc.
242 Previously this command was known as git-diff-script.
244 gitlink:git-fetch[1]::
245 Download from a remote repository via various protocols.
246 Previously this command was known as git-fetch-script.
248 gitlink:git-format-patch[1]::
249 Prepare patches for e-mail submission.
250 Previously this command was known as git-format-patch-script.
252 gitlink:git-grep[1]::
253 Print lines matching a pattern
257 Previously this command was known as git-log-script.
259 gitlink:git-ls-remote[1]::
260 Shows references in a remote or local repository.
261 Previously this command was known as git-ls-remote-script.
263 gitlink:git-merge[1]::
264 Grand unified merge driver.
266 gitlink:git-octopus[1]::
267 Merge more than two commits.
268 Previously this command was known as git-octopus-script.
270 gitlink:git-pull[1]::
271 Fetch from and merge with a remote repository.
272 Previously this command was known as git-pull-script.
274 gitlink:git-push[1]::
275 Update remote refs along with associated objects.
276 Previously this command was known as git-push-script.
278 gitlink:git-rebase[1]::
279 Rebase local commits to new upstream head.
280 Previously this command was known as git-rebase-script.
282 gitlink:git-rename[1]::
283 Rename files and directories.
284 Previously this command was known as git-rename-script.
286 gitlink:git-repack[1]::
287 Pack unpacked objects in a repository.
288 Previously this command was known as git-repack-script.
290 gitlink:git-reset[1]::
291 Reset current HEAD to the specified state.
292 Previously this command was known as git-reset-script.
294 gitlink:git-resolve[1]::
296 Previously this command was known as git-resolve-script.
298 gitlink:git-revert[1]::
299 Revert an existing commit.
300 Previously this command was known as git-revert-script.
302 gitlink:git-shortlog[1]::
303 Summarizes 'git log' output.
305 gitlink:git-show-branch[1]::
306 Show branches and their commits.
308 gitlink:git-status[1]::
309 Shows the working tree status.
310 Previously this command was known as git-status-script.
312 gitlink:git-verify-tag[1]::
313 Check the GPG signature of tag.
314 Previously this command was known as git-verify-tag-script.
316 gitlink:git-whatchanged[1]::
317 Shows commit logs and differences they introduce.
324 gitlink:git-applypatch[1]::
325 Apply one patch extracted from an e-mail.
327 gitlink:git-archimport[1]::
328 Import an arch repository into git.
329 Previously this command was known as git-archimport-script.
331 gitlink:git-convert-objects[1]::
332 Converts old-style GIT repository
333 Previously this command was known as git-convert-cache.
335 gitlink:git-cvsimport[1]::
336 Salvage your data out of another SCM people love to hate.
337 Previously this command was known as git-cvsimport-script.
339 gitlink:git-merge-one-file[1]::
340 The standard helper program to use with "git-merge-index"
341 Previously this command was known as git-merge-one-file-script.
343 gitlink:git-prune[1]::
344 Prunes all unreachable objects from the object database
345 Previously this command was known as git-prune-script.
347 gitlink:git-relink[1]::
348 Hardlink common objects in local repositories.
349 Previously this command was known as git-relink-script.
351 gitlink:git-sh-setup[1]::
352 Common git shell script setup code.
353 Previously this command was known as git-sh-setup-script.
356 An example script to create a tag object signed with GPG
357 Previously this command was known as git-tag-script.
362 gitlink:git-cherry[1]::
363 Find commits not merged upstream.
365 gitlink:git-count-objects[1]::
366 Count unpacked number of objects and their disk consumption.
367 Previously this command was known as git-count-objects-script.
369 gitlink:git-daemon[1]::
370 A really simple server for GIT repositories.
372 gitlink:git-diff-helper[1]::
373 Generates patch format output for git-diff-*
375 gitlink:git-get-tar-commit-id[1]::
376 Extract commit ID from an archive created using git-tar-tree.
378 gitlink:git-mailinfo[1]::
379 Extracts patch from a single e-mail message.
381 gitlink:git-mailsplit[1]::
384 gitlink:git-patch-id[1]::
385 Compute unique ID for a patch.
387 gitlink:git-parse-remote[1]::
388 Routines to help parsing $GIT_DIR/remotes/
389 Previously this command was known as git-parse-remote-script.
391 gitlink:git-request-pull[1]::
393 Previously this command was known as git-request-pull-script.
395 gitlink:git-rev-parse[1]::
396 Pick out and massage parameters.
398 gitlink:git-send-email[1]::
399 Send patch e-mails out of "format-patch --mbox" output.
400 Previously this command was known as git-send-email-script.
402 gitlink:git-stripspace[1]::
403 Filter out empty lines.
406 Commands not yet documented
407 ---------------------------
413 Identifier Terminology
414 ----------------------
416 Indicates the sha1 identifier for any type of object
419 Indicates a blob object sha1 identifier
422 Indicates a tree object sha1 identifier
425 Indicates a commit object sha1 identifier
428 Indicates a tree, commit or tag object sha1 identifier. A
429 command that takes a <tree-ish> argument ultimately wants to
430 operate on a <tree> object but automatically dereferences
431 <commit> and <tag> objects that point at a <tree>.
434 Indicates that an object type is required.
435 Currently one of: blob/tree/commit/tag
438 Indicates a filename - always relative to the root of
439 the tree structure GIT_INDEX_FILE describes.
443 Any git command accepting any <object> can also use the following
447 indicates the head of the repository (ie the contents of
451 (ie the contents of `$GIT_DIR/refs/tags/<tag>`)
454 (ie the contents of `$GIT_DIR/refs/heads/<head>`)
456 a valid snapshot 'name'+
457 (ie the contents of `$GIT_DIR/refs/snap/<snap>`)
460 File/Directory Structure
461 ------------------------
463 Please see link:repository-layout.html[repository layout] document.
465 Higher level SCMs may provide and manage additional information in the
471 Please see link:glossary.html[glossary] document.
474 Environment Variables
475 ---------------------
476 Various git commands use the following environment variables:
480 These environment variables apply to 'all' core git commands. Nb: it
481 is worth noting that they may be used/overridden by SCMS sitting above
482 git so take care if using Cogito etc
485 This environment allows the specification of an alternate
486 cache/index file. If not specified, the default of
487 `$GIT_DIR/index` is used.
489 'GIT_OBJECT_DIRECTORY'::
490 If the object storage directory is specified via this
491 environment variable then the sha1 directories are created
492 underneath - otherwise the default `$GIT_DIR/objects`
495 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
496 Due to the immutable nature of git objects, old objects can be
497 archived into shared, read-only directories. This variable
498 specifies a ":" separated list of git object directories which
499 can be used to search for git objects. New objects will not be
500 written to these directories.
503 If the 'GIT_DIR' environment variable is set then it specifies
504 a path to use instead of `./.git` for the base of the
512 'GIT_COMMITTER_NAME'::
513 'GIT_COMMITTER_EMAIL'::
514 see gitlink:git-commit-tree[1]
519 'GIT_EXTERNAL_DIFF'::
520 see the "generating patches" section in :
521 gitlink:git-diff-index[1];
522 gitlink:git-diff-files[1];
523 gitlink:git-diff-tree[1]
525 Discussion[[Discussion]]
526 ------------------------
531 Written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>.
535 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
539 Part of the gitlink:git[7] suite