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