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