Documentation / repository-layout.txton commit Merge branch 'fixes' (952f87a)
   1GIT repository layout
   2=====================
   3v0.99.5, Sep 2005
   4
   5You may find these things in your git repository (`.git`
   6directory for a repository associated with your working tree, or
   7`'project'.git` directory for a public 'naked' repository).
   8
   9objects::
  10        Object store associated with this repository.  Usually
  11        an object store is self sufficient (i.e. all the objects
  12        that are referred to by an object found in it are also
  13        found in it), but there are couple of ways to violate
  14        it.
  15+
  16. You could populate the repository by running a commit walker
  17without `-a` option.  Depending on which options are given, you
  18could have only commit objects without associated blobs and
  19trees this way, for example.  A repository with this kind of
  20incomplete object store is not suitable to be published to the
  21outside world but sometimes useful for private repository.
  22. You can be using `objects/info/alternates` mechanism, or
  23`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
  24objects from other object stores.  A repository with this kind
  25of incompete object store is not suitable to be published for
  26use with dumb transports but otherwise is OK as long as
  27`objects/info/alternates` points at the right object stores
  28it borrows from.
  29
  30objects/[0-9a-f][0-9a-f]::
  31        Traditionally, each object is stored in its own file.
  32        They are split into 256 subdirectories using the first
  33        two letters from its object name to keep the number of
  34        directory entries `objects` directory itself needs to
  35        hold.  Objects found here are often called 'unpacked'
  36        objects.
  37
  38objects/pack::
  39        Packs (files that store many object in compressed form,
  40        along with index files to allow them to be randomly
  41        accessed) are found in this directory.
  42
  43objects/info::
  44        Additional information about the object store is
  45        recorded in this directory.
  46
  47objects/info/packs::
  48        This file is to help dumb transports discover what packs
  49        are available in this object store.  Whenever a pack is
  50        added or removed, `git update-server-info` should be run
  51        to keep this file up-to-date if the repository is
  52        published for dumb transports.  `git repack` does this
  53        by default.
  54
  55objects/info/alternates::
  56        This file records absolute filesystem paths of alternate
  57        object stores that this object store borrows objects
  58        from, one pathname per line.
  59
  60refs::
  61        References are stored in subdirectories of this
  62        directory.  The `git prune` command knows to keep
  63        objects reachable from refs found in this directory and
  64        its subdirectories.
  65
  66refs/heads/`name`::
  67        records tip-of-the-tree commit objects of branch `name`
  68
  69refs/tags/`name`::
  70        records any object name (not necessarily a commit
  71        object, or a tag object that points at a commit object).
  72
  73HEAD::
  74        A symlink of the form `refs/heads/'name'` to point at
  75        the current branch, if exists.  It does not mean much if
  76        the repository is not associated with any working tree
  77        (i.e. 'naked' repository), but a valid git repository
  78        *must* have such a symlink here.  It is legal if the
  79        named branch 'name' does not (yet) exist.
  80
  81branches::
  82        A slightly deprecated way to store shorthands to be used
  83        to specify URL to `git fetch`, `git pull` and `git push`
  84        commands is to store a file in `branches/'name'` and
  85        give 'name' to these commands in place of 'repository'
  86        argument.
  87
  88hooks::
  89        Hooks are customization scripts used by various git
  90        commands.  A handful of sample hooks are installed when
  91        `git init-db` is run, but all of them are disabled by
  92        default.  To enable, they need to be made executable.
  93
  94index::
  95        The current index file for the repository.  It is
  96        usually not found in a naked repository.
  97
  98info::
  99        Additional information about the repository is recorded
 100        in this directory.
 101
 102info/refs::
 103        This file is to help dumb transports to discover what
 104        refs are available in this repository.  Whenever you
 105        create/delete a new branch or a new tag, `git
 106        update-server-info` should be run to keep this file
 107        up-to-date if the repository is published for dumb
 108        transports.  The `git-receive-pack` command, which is
 109        run on a remote repository when you `git push` into it,
 110        runs `hooks/update` hook to help you achive this.
 111
 112info/grafts::
 113        This file records fake commit ancestry information, to
 114        pretend the set of parents a commit has is different
 115        from how the commit was actually created.  One record
 116        per line describes a commit and its fake parents by
 117        listing their 40-byte hexadecimal object names separated
 118        by a space and terminated by a newline.
 119
 120info/exclude::
 121        This file, by convention among Porcelains, stores the
 122        exclude pattern list.  `git status` looks at it, but
 123        otherwise it is not looked at by any of the core GIT
 124        commands.
 125
 126remotes::
 127        Stores shorthands to be used to give URL and default
 128        refnames to interact with remote repository to `git
 129        fetch`, `git pull` and `git push` commands.