Code

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