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