1git(7) 2====== 3v0.99.6, Sep 2005 4 5NAME 6---- 7git - the stupid content tracker 8 9 10SYNOPSIS 11-------- 12'git-<command>' <args> 13 14DESCRIPTION 15----------- 16 17This is reference information for the core git commands. 18 19Before reading this cover to cover, you may want to take a look 20at the link:tutorial.html[tutorial] document. 21 22The <<Discussion>> section below contains much useful definition and 23clarification info - read that first. And of the commands, I suggest 24reading link:git-update-index.html[git-update-index] and 25link:git-read-tree.html[git-read-tree] first - I wish I had! 26 27If you are migrating from CVS, link:cvs-migration.html[cvs migration] 28document may be helpful after you finish the tutorial. 29 30After you get the general feel from the tutorial and this 31overview page, you may want to take a look at the 32link:howto-index.html[howto] documents. 33 34 35David Greaves <david@dgreaves.com> 3608/05/05 37 38Updated by Junio C Hamano <junkio@cox.net> on 2005-05-05 to 39reflect recent changes. 40 41Commands Overview 42----------------- 43The git commands can helpfully be split into those that manipulate 44the repository, the cache and the working fileset, those that 45interrogate and compare them, and those that moves objects and 46references between repositories. 47 48In addition, git itself comes with a spartan set of porcelain 49commands. They are usable but are not meant to compete with real 50Porcelains. 51 52There are also some ancillary programs that can be viewed as useful 53aids for using the core commands but which are unlikely to be used by 54SCMs layered over git. 55 56Manipulation commands 57~~~~~~~~~~~~~~~~~~~~~ 58link:git-apply.html[git-apply]:: 59 Reads a "diff -up1" or git generated patch file and 60 applies it to the working tree. 61 62link:git-checkout-index.html[git-checkout-index]:: 63 Copy files from the cache to the working directory 64 Previously this command was known as git-checkout-cache. 65 66link:git-commit-tree.html[git-commit-tree]:: 67 Creates a new commit object 68 69link:git-hash-object.html[git-hash-object]:: 70 Computes the object ID from a file. 71 72link:git-init-db.html[git-init-db]:: 73 Creates an empty git object database 74 75link:git-merge-index.html[git-merge-index]:: 76 Runs a merge for files needing merging 77 Previously this command was known as git-merge-cache. 78 79link:git-mktag.html[git-mktag]:: 80 Creates a tag object 81 82link:git-pack-objects.html[git-pack-objects]:: 83 Creates a packed archive of objects. 84 85link:git-prune-packed.html[git-prune-packed]:: 86 Remove extra objects that are already in pack files. 87 88link:git-read-tree.html[git-read-tree]:: 89 Reads tree information into the directory cache 90 91link:git-unpack-objects.html[git-unpack-objects]:: 92 Unpacks objects out of a packed archive. 93 94link:git-update-index.html[git-update-index]:: 95 Modifies the index or directory cache 96 Previously this command was known as git-update-cache. 97 98link:git-write-tree.html[git-write-tree]:: 99 Creates a tree from the current cache 100 101 102Interrogation commands 103~~~~~~~~~~~~~~~~~~~~~~ 104 105link:git-cat-file.html[git-cat-file]:: 106 Provide content or type information for repository objects 107 108link:git-diff-index.html[git-diff-index]:: 109 Compares content and mode of blobs between the cache and repository 110 Previously this command was known as git-diff-cache. 111 112link:git-diff-files.html[git-diff-files]:: 113 Compares files in the working tree and the cache 114 115link:git-diff-stages.html[git-diff-stages]:: 116 Compares two "merge stages" in the index file. 117 118link:git-diff-tree.html[git-diff-tree]:: 119 Compares the content and mode of blobs found via two tree objects 120 121link:git-export.html[git-export]:: 122 Exports each commit and a diff against each of its parents 123 124link:git-fsck-objects.html[git-fsck-objects]:: 125 Verifies the connectivity and validity of the objects in the database 126 Previously this command was known as git-fsck-cache. 127 128link:git-ls-files.html[git-ls-files]:: 129 Information about files in the cache/working directory 130 131link:git-ls-tree.html[git-ls-tree]:: 132 Displays a tree object in human readable form 133 134link:git-merge-base.html[git-merge-base]:: 135 Finds as good a common ancestor as possible for a merge 136 137link:git-rev-list.html[git-rev-list]:: 138 Lists commit objects in reverse chronological order 139 140link:git-rev-tree.html[git-rev-tree]:: 141 Provides the revision tree for one or more commits 142 143link:git-show-index.html[git-show-index]:: 144 Displays contents of a pack idx file. 145 146link:git-tar-tree.html[git-tar-tree]:: 147 Creates a tar archive of the files in the named tree 148 149link:git-unpack-file.html[git-unpack-file]:: 150 Creates a temporary file with a blob's contents 151 152link:git-var.html[git-var]:: 153 Displays a git logical variable 154 155link:git-verify-pack.html[git-verify-pack]:: 156 Validates packed GIT archive files 157 158The interrogate commands may create files - and you can force them to 159touch the working file set - but in general they don't 160 161 162Synching repositories 163~~~~~~~~~~~~~~~~~~~~~ 164 165link:git-clone-pack.html[git-clone-pack]:: 166 Clones a repository into the current repository (engine 167 for ssh and local transport) 168 169link:git-fetch-pack.html[git-fetch-pack]:: 170 Updates from a remote repository. 171 172link:git-http-fetch.html[git-http-fetch]:: 173 Downloads a remote GIT repository via HTTP 174 Previously this command was known as git-http-pull. 175 176link:git-local-fetch.html[git-local-fetch]:: 177 Duplicates another GIT repository on a local system 178 Previously this command was known as git-local-pull. 179 180link:git-peek-remote.html[git-peek-remote]:: 181 Lists references on a remote repository using upload-pack protocol. 182 183link:git-receive-pack.html[git-receive-pack]:: 184 Invoked by 'git-send-pack' to receive what is pushed to it. 185 186link:git-send-pack.html[git-send-pack]:: 187 Pushes to a remote repository, intelligently. 188 189link:git-ssh-fetch.html[git-ssh-fetch]:: 190 Pulls from a remote repository over ssh connection 191 Previously this command was known as git-ssh-pull. 192 193link:git-ssh-upload.html[git-ssh-upload]:: 194 Helper "server-side" program used by git-ssh-fetch 195 Previously this command was known as git-ssh-push. 196 197link:git-update-server-info.html[git-update-server-info]:: 198 Updates auxiliary information on a dumb server to help 199 clients discover references and packs on it. 200 201link:git-upload-pack.html[git-upload-pack]:: 202 Invoked by 'git-clone-pack' and 'git-fetch-pack' to push 203 what are asked for. 204 205 206Porcelain-ish Commands 207---------------------- 208 209link:git-add.html[git-add]:: 210 Add paths to the index file. 211 Previously this command was known as git-add-script. 212 213link:git-applymbox.html[git-applymbox]:: 214 Apply patches from a mailbox. 215 216link:git-bisect.html[git-bisect]:: 217 Find the change that introduced a bug. 218 Previously this command was known as git-bisect-script. 219 220link:git-branch.html[git-branch]:: 221 Create and Show branches. 222 Previously this command was known as git-branch-script. 223 224link:git-checkout.html[git-checkout]:: 225 Checkout and switch to a branch. 226 Previously this command was known as git-checkout-script. 227 228link:git-cherry-pick.html[git-cherry-pick]:: 229 Cherry-pick the effect of an existing commit. 230 Previously this command was known as git-cherry-pick-script. 231 232link:git-clone.html[git-clone]:: 233 Clones a repository into a new directory. 234 Previously this command was known as git-clone-script. 235 236link:git-commit.html[git-commit]:: 237 Record changes to the repository. 238 Previously this command was known as git-commit-script. 239 240link:git-diff.html[git-diff]:: 241 Show changes between commits, commit and working tree, etc. 242 Previously this command was known as git-diff-script. 243 244link:git-fetch.html[git-fetch]:: 245 Download from a remote repository via various protocols. 246 Previously this command was known as git-fetch-script. 247 248link:git-format-patch.html[git-format-patch]:: 249 Prepare patches for e-mail submission. 250 Previously this command was known as git-format-patch-script. 251 252link:git-grep.html[git-grep]:: 253 Print lines matching a pattern 254 255link:git-log.html[git-log]:: 256 Shows commit logs. 257 Previously this command was known as git-log-script. 258 259link:git-ls-remote.html[git-ls-remote]:: 260 Shows references in a remote or local repository. 261 Previously this command was known as git-ls-remote-script. 262 263link:git-merge.html[git-merge]:: 264 Grand unified merge driver. 265 266link:git-octopus.html[git-octopus]:: 267 Merge more than two commits. 268 Previously this command was known as git-octopus-script. 269 270link:git-pull.html[git-pull]:: 271 Fetch from and merge with a remote repository. 272 Previously this command was known as git-pull-script. 273 274link:git-push.html[git-push]:: 275 Update remote refs along with associated objects. 276 Previously this command was known as git-push-script. 277 278link:git-rebase.html[git-rebase]:: 279 Rebase local commits to new upstream head. 280 Previously this command was known as git-rebase-script. 281 282link:git-rename.html[git-rename]:: 283 Rename files and directories. 284 Previously this command was known as git-rename-script. 285 286link:git-repack.html[git-repack]:: 287 Pack unpacked objects in a repository. 288 Previously this command was known as git-repack-script. 289 290link:git-reset.html[git-reset]:: 291 Reset current HEAD to the specified state. 292 Previously this command was known as git-reset-script. 293 294link:git-resolve.html[git-resolve]:: 295 Merge two commits. 296 Previously this command was known as git-resolve-script. 297 298link:git-revert.html[git-revert]:: 299 Revert an existing commit. 300 Previously this command was known as git-revert-script. 301 302link:git-shortlog.html[git-shortlog]:: 303 Summarizes 'git log' output. 304 305link:git-show-branch.html[git-show-branch]:: 306 Show branches and their commits. 307 308link:git-status.html[git-status]:: 309 Shows the working tree status. 310 Previously this command was known as git-status-script. 311 312link:git-verify-tag.html[git-verify-tag]:: 313 Check the GPG signature of tag. 314 Previously this command was known as git-verify-tag-script. 315 316link:git-whatchanged.html[git-whatchanged]:: 317 Shows commit logs and differences they introduce. 318 319 320Ancillary Commands 321------------------ 322Manipulators: 323 324link:git-applypatch.html[git-applypatch]:: 325 Apply one patch extracted from an e-mail. 326 327link:git-archimport.html[git-archimport]:: 328 Import an arch repository into git. 329 Previously this command was known as git-archimport-script. 330 331link:git-convert-objects.html[git-convert-objects]:: 332 Converts old-style GIT repository 333 Previously this command was known as git-convert-cache. 334 335link:git-cvsimport.html[git-cvsimport]:: 336 Salvage your data out of another SCM people love to hate. 337 Previously this command was known as git-cvsimport-script. 338 339link:git-merge-one-file.html[git-merge-one-file]:: 340 The standard helper program to use with "git-merge-index" 341 Previously this command was known as git-merge-one-file-script. 342 343link:git-prune.html[git-prune]:: 344 Prunes all unreachable objects from the object database 345 Previously this command was known as git-prune-script. 346 347link:git-relink.html[git-relink]:: 348 Hardlink common objects in local repositories. 349 Previously this command was known as git-relink-script. 350 351link:git-sh-setup.html[git-sh-setup]:: 352 Common git shell script setup code. 353 Previously this command was known as git-sh-setup-script. 354 355link:git-tag.html[git-tag]:: 356 An example script to create a tag object signed with GPG 357 Previously this command was known as git-tag-script. 358 359 360Interrogators: 361 362link:git-build-rev-cache.html[git-build-rev-cache]:: 363 Create or update a rev-cache file. 364 365link:git-cherry.html[git-cherry]:: 366 Find commits not merged upstream. 367 368link:git-count-objects.html[git-count-objects]:: 369 Count unpacked number of objects and their disk consumption. 370 Previously this command was known as git-count-objects-script. 371 372link:git-daemon.html[git-daemon]:: 373 A really simple server for GIT repositories. 374 375link:git-diff-helper.html[git-diff-helper]:: 376 Generates patch format output for git-diff-* 377 378link:git-get-tar-commit-id.html[git-get-tar-commit-id]:: 379 Extract commit ID from an archive created using git-tar-tree. 380 381link:git-mailinfo.html[git-mailinfo]:: 382 Extracts patch from a single e-mail message. 383 384link:git-mailsplit.html[git-mailsplit]:: 385 git-mailsplit. 386 387link:git-patch-id.html[git-patch-id]:: 388 Compute unique ID for a patch. 389 390link:git-parse-remote.html[git-parse-remote]:: 391 Routines to help parsing $GIT_DIR/remotes/ 392 Previously this command was known as git-parse-remote-script. 393 394link:git-request-pull.html[git-request-pull]:: 395 git-request-pull. 396 Previously this command was known as git-request-pull-script. 397 398link:git-rev-parse.html[git-rev-parse]:: 399 Pick out and massage parameters. 400 401link:git-send-email.html[git-send-email]:: 402 Send patch e-mails out of "format-patch --mbox" output. 403 Previously this command was known as git-send-email-script. 404 405link:git-show-rev-cache.html[git-show-rev-cache]:: 406 Show the contents of a rev-cache file. 407 408link:git-stripspace.html[git-stripspace]:: 409 Filter out empty lines. 410 411 412Commands not yet documented 413--------------------------- 414 415link:gitk.html[gitk]:: 416 gitk. 417 418 419Identifier Terminology 420---------------------- 421<object>:: 422 Indicates the sha1 identifier for any type of object 423 424<blob>:: 425 Indicates a blob object sha1 identifier 426 427<tree>:: 428 Indicates a tree object sha1 identifier 429 430<commit>:: 431 Indicates a commit object sha1 identifier 432 433<tree-ish>:: 434 Indicates a tree, commit or tag object sha1 identifier. A 435 command that takes a <tree-ish> argument ultimately wants to 436 operate on a <tree> object but automatically dereferences 437 <commit> and <tag> objects that point at a <tree>. 438 439<type>:: 440 Indicates that an object type is required. 441 Currently one of: blob/tree/commit/tag 442 443<file>:: 444 Indicates a filename - always relative to the root of 445 the tree structure GIT_INDEX_FILE describes. 446 447Symbolic Identifiers 448-------------------- 449Any git command accepting any <object> can also use the following 450symbolic notation: 451 452HEAD:: 453 indicates the head of the repository (ie the contents of 454 `$GIT_DIR/HEAD`) 455<tag>:: 456 a valid tag 'name'+ 457 (ie the contents of `$GIT_DIR/refs/tags/<tag>`) 458<head>:: 459 a valid head 'name'+ 460 (ie the contents of `$GIT_DIR/refs/heads/<head>`) 461<snap>:: 462 a valid snapshot 'name'+ 463 (ie the contents of `$GIT_DIR/refs/snap/<snap>`) 464 465 466File/Directory Structure 467------------------------ 468 469Please see link:repository-layout.html[repository layout] document. 470 471Higher level SCMs may provide and manage additional information in the 472GIT_DIR. 473 474 475Terminology 476----------- 477Please see link:glossary.html[glossary] document. 478 479 480Environment Variables 481--------------------- 482Various git commands use the following environment variables: 483 484The git Repository 485~~~~~~~~~~~~~~~~~~ 486These environment variables apply to 'all' core git commands. Nb: it 487is worth noting that they may be used/overridden by SCMS sitting above 488git so take care if using Cogito etc 489 490'GIT_INDEX_FILE':: 491 This environment allows the specification of an alternate 492 cache/index file. If not specified, the default of 493 `$GIT_DIR/index` is used. 494 495'GIT_OBJECT_DIRECTORY':: 496 If the object storage directory is specified via this 497 environment variable then the sha1 directories are created 498 underneath - otherwise the default `$GIT_DIR/objects` 499 directory is used. 500 501'GIT_ALTERNATE_OBJECT_DIRECTORIES':: 502 Due to the immutable nature of git objects, old objects can be 503 archived into shared, read-only directories. This variable 504 specifies a ":" separated list of git object directories which 505 can be used to search for git objects. New objects will not be 506 written to these directories. 507 508'GIT_DIR':: 509 If the 'GIT_DIR' environment variable is set then it specifies 510 a path to use instead of `./.git` for the base of the 511 repository. 512 513git Commits 514~~~~~~~~~~~ 515'GIT_AUTHOR_NAME':: 516'GIT_AUTHOR_EMAIL':: 517'GIT_AUTHOR_DATE':: 518'GIT_COMMITTER_NAME':: 519'GIT_COMMITTER_EMAIL':: 520 see link:git-commit-tree.html[git-commit-tree] 521 522git Diffs 523~~~~~~~~~ 524'GIT_DIFF_OPTS':: 525'GIT_EXTERNAL_DIFF':: 526 see the "generating patches" section in : 527 link:git-diff-index.html[git-diff-index]; 528 link:git-diff-files.html[git-diff-files]; 529 link:git-diff-tree.html[git-diff-tree] 530 531Discussion[[Discussion]] 532------------------------ 533include::../README[] 534 535Author 536------ 537Written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>. 538 539Documentation 540-------------- 541Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 542 543GIT 544--- 545Part of the link:git.html[git] suite 546