Documentation / repository-layout.txton commit Merge git://git.kernel.org/pub/scm/gitk/gitk (c7ea453)
   1git repository layout
   2=====================
   3
   4You may find these things in your git repository (`.git`
   5directory for a repository associated with your working tree, or
   6`'project'.git` directory for a public 'bare' repository. It is
   7also possible to have a working tree where `.git` is a plain
   8ascii file containing `gitdir: <path>`, i.e. the path to the
   9real git repository).
  10
  11objects::
  12        Object store associated with this repository.  Usually
  13        an object store is self sufficient (i.e. all the objects
  14        that are referred to by an object found in it are also
  15        found in it), but there are couple of ways to violate
  16        it.
  17+
  18. You could populate the repository by running a commit walker
  19without `-a` option.  Depending on which options are given, you
  20could have only commit objects without associated blobs and
  21trees this way, for example.  A repository with this kind of
  22incomplete object store is not suitable to be published to the
  23outside world but sometimes useful for private repository.
  24. You also could have an incomplete but locally usable repository
  25by cloning shallowly.  See linkgit:git-clone[1].
  26. You can be using `objects/info/alternates` mechanism, or
  27`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
  28objects from other object stores.  A repository with this kind
  29of incomplete object store is not suitable to be published for
  30use with dumb transports but otherwise is OK as long as
  31`objects/info/alternates` points at the right object stores
  32it borrows from.
  33
  34objects/[0-9a-f][0-9a-f]::
  35        Traditionally, each object is stored in its own file.
  36        They are split into 256 subdirectories using the first
  37        two letters from its object name to keep the number of
  38        directory entries `objects` directory itself needs to
  39        hold.  Objects found here are often called 'unpacked'
  40        (or 'loose') objects.
  41
  42objects/pack::
  43        Packs (files that store many object in compressed form,
  44        along with index files to allow them to be randomly
  45        accessed) are found in this directory.
  46
  47objects/info::
  48        Additional information about the object store is
  49        recorded in this directory.
  50
  51objects/info/packs::
  52        This file is to help dumb transports discover what packs
  53        are available in this object store.  Whenever a pack is
  54        added or removed, `git update-server-info` should be run
  55        to keep this file up-to-date if the repository is
  56        published for dumb transports.  `git repack` does this
  57        by default.
  58
  59objects/info/alternates::
  60        This file records paths to alternate object stores that
  61        this object store borrows objects from, one pathname per
  62        line. Note that not only native Git tools use it locally,
  63        but the HTTP fetcher also tries to use it remotely; this
  64        will usually work if you have relative paths (relative
  65        to the object database, not to the repository!) in your
  66        alternates file, but it will not work if you use absolute
  67        paths unless the absolute path in filesystem and web URL
  68        is the same. See also 'objects/info/http-alternates'.
  69
  70objects/info/http-alternates::
  71        This file records URLs to alternate object stores that
  72        this object store borrows objects from, to be used when
  73        the repository is fetched over HTTP.
  74
  75refs::
  76        References are stored in subdirectories of this
  77        directory.  The `git prune` command knows to keep
  78        objects reachable from refs found in this directory and
  79        its subdirectories.
  80
  81refs/heads/`name`::
  82        records tip-of-the-tree commit objects of branch `name`
  83
  84refs/tags/`name`::
  85        records any object name (not necessarily a commit
  86        object, or a tag object that points at a commit object).
  87
  88refs/remotes/`name`::
  89        records tip-of-the-tree commit objects of branches copied
  90        from a remote repository.
  91
  92packed-refs::
  93        records the same information as refs/heads/, refs/tags/,
  94        and friends record in a more efficient way.  See
  95        linkgit:git-pack-refs[1].
  96
  97HEAD::
  98        A symref (see glossary) to the `refs/heads/` namespace
  99        describing the currently active branch.  It does not mean
 100        much if the repository is not associated with any working tree
 101        (i.e. a 'bare' repository), but a valid git repository
 102        *must* have the HEAD file; some porcelains may use it to
 103        guess the designated "default" branch of the repository
 104        (usually 'master').  It is legal if the named branch
 105        'name' does not (yet) exist.  In some legacy setups, it is
 106        a symbolic link instead of a symref that points at the current
 107        branch.
 108+
 109HEAD can also record a specific commit directly, instead of
 110being a symref to point at the current branch.  Such a state
 111is often called 'detached HEAD', and almost all commands work
 112identically as normal.  See linkgit:git-checkout[1] for
 113details.
 114
 115branches::
 116        A slightly deprecated way to store shorthands to be used
 117        to specify URL to `git fetch`, `git pull` and `git push`
 118        commands is to store a file in `branches/'name'` and
 119        give 'name' to these commands in place of 'repository'
 120        argument.
 121
 122hooks::
 123        Hooks are customization scripts used by various git
 124        commands.  A handful of sample hooks are installed when
 125        `git init` is run, but all of them are disabled by
 126        default.  To enable, they need to be made executable.
 127        Read linkgit:githooks[5][hooks] for more details about
 128        each hook.
 129
 130index::
 131        The current index file for the repository.  It is
 132        usually not found in a bare repository.
 133
 134info::
 135        Additional information about the repository is recorded
 136        in this directory.
 137
 138info/refs::
 139        This file helps dumb transports discover what refs are
 140        available in this repository.  If the repository is
 141        published for dumb transports, this file should be
 142        regenerated by `git update-server-info` every time a tag
 143        or branch is created or modified.  This is normally done
 144        from the `hooks/update` hook, which is run by the
 145        `git-receive-pack` command when you `git push` into the
 146        repository.
 147
 148info/grafts::
 149        This file records fake commit ancestry information, to
 150        pretend the set of parents a commit has is different
 151        from how the commit was actually created.  One record
 152        per line describes a commit and its fake parents by
 153        listing their 40-byte hexadecimal object names separated
 154        by a space and terminated by a newline.
 155
 156info/exclude::
 157        This file, by convention among Porcelains, stores the
 158        exclude pattern list. `.gitignore` is the per-directory
 159        ignore file.  `git status`, `git add`, `git rm` and `git
 160        clean` look at it but the core git commands do not look
 161        at it.  See also: linkgit:gitignore[5].
 162
 163remotes::
 164        Stores shorthands to be used to give URL and default
 165        refnames to interact with remote repository to `git
 166        fetch`, `git pull` and `git push` commands.
 167
 168logs::
 169        Records of changes made to refs are stored in this
 170        directory.  See the documentation on git-update-ref
 171        for more information.
 172
 173logs/refs/heads/`name`::
 174        Records all changes made to the branch tip named `name`.
 175
 176logs/refs/tags/`name`::
 177        Records all changes made to the tag named `name`.
 178
 179shallow::
 180        This is similar to `info/grafts` but is internally used
 181        and maintained by shallow clone mechanism.  See `--depth`
 182        option to linkgit:git-clone[1] and linkgit:git-fetch[1].