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